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>';

        $(".moretxt").click(function ()
            if ($(this).hasClass("sfdc_richtext"))


            return false;

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.

  • 1
    In Salesforce, you'll want to use jQuery's no conflict mode. var j = jQuery.noConflict(); Then replace $ with j. – Matt K Feb 18 '14 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 Feb 19 '14 at 13:38

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.


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"/>
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.