1

I want to open a popup window using jQuery after clicking on "more" button..

jQuery more/less link in pageblock table

<script src="https://code.jquery.com/jquery-1.8.2.js" type="text/javascript"></script>
<title>jQuery Add More/Less link to Text</title>
<script type="text/javascript">
    $(function ()
    {
        var showChar = 120,
        showtxt = "more",
        hidetxt = "less";
        $('.sfdc_richtext').each(function ()
        {
            var content = $(this).text();
            if (content.length > showChar)
            {
                var con = content.substr(0, showChar);
                var hcon = content.substr(showChar, content.length - showChar);
                var txt = con + '<span class="dots">...</span><span class="morecontent"><span>' + hcon + '</span>&nbsp;&nbsp;<a href="" class="moretxt">' + showtxt + '</a></span>';
                $(this).html(txt);
            }
        });

        $(".moretxt").click(function ()
        {
            if ($(this).hasClass("sfdc_richtext"))
            {
                $(this).removeClass("sfdc_richtext");
                $(this).text(showtxt);
            }
            else
            {
                $(this).addClass("sfdc_richtext");
                $(this).text(hidetxt);
            }

            $(this).parent().prev().toggle();
            $(this).prev().toggle();

            return false;
        });
    });
</script>

Using this jQuery code I am able to show the more/less link in which characters are more than 120. Now I want to open a VF window pop when anyone clicks on that more link. I am new to jQuery please help. I also need to pass an id to that VF page window popup when anyone clicks on more link.

enter image description here

above is the page block table and more link in image.

 <apex:pageBlockTable value="{!salesFaqList}" var="faq" id="pbTable" rendered="{!showData}">

                  <apex:column value="{!faq.FAQ_Categories__c}" width="190px" style="height:50px"/>

      <apex:column value="{!faq.Answer__c}" /> 
 </apex:pageBlockTable >

Answer is the last field in page block table. I want to open a VF pop up window on click of that link and also pass ID in URL of that page.

2
  • 1
    In Salesforce, you'll want to use jQuery's no conflict mode. var j = jQuery.noConflict(); Then replace $ with j.
    – Matt K
    Commented Feb 18, 2014 at 19:49
  • Hi More/Less link are working fine..I want to open a window pop on more link..I dont know how to do that..??Can you help
    – miku
    Commented Feb 19, 2014 at 13:38

1 Answer 1

0

I dont understand well your question.. but this link could to help you, about how to do a popup when you click it in a link.

https://vibanterence-apexvisualforce.blogspot.com.es/2014/07/visualforce-jquery-ui-dialog-displaying.html?showComment=1462893676752#c7480854185459541626

If you need more help, tell me. I did this tutorial. ;) And it worked! I had to use this jquerys...

  <apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" />
    <apex:includeScript value="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js" />
    <apex:stylesheet value="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.theme.css"/>
    <apex:stylesheet value="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.base.css"/>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .