unable to apply Truncate paragraph using jquery
<p>i have written a small jquery function for Truncateing paragraph. But it does not work for me. i.e it does not show a link for me "show more" or "show less".</p>

<p>Please help me to solve my problem.</p>

<p>My code works perfect if my paragraph is simple/manual. But if i show a paragraph  added through a rich text editor,which contains some bold words, para etc
Then a face problem.(i.e it does not show a link for me "show more" or "show less".)</p>

<p>eg.</p>

<p><strong>works good if my para is</strong> (without any <code>&lt;b&gt;,&lt;p&gt;</code>)**</p>

<pre><code>&lt;p class="descpara"&gt;  
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem      &lt;/p&gt;
</code></pre>

<p>Does not work if i include(<code>&lt;b&gt;..&lt;/b&gt; ,&lt;p&gt;..&lt;/p&gt;</code>) </p>

<pre><code>  &lt;p class="descpara"&gt;  
&lt;b&gt;Lorem Ipsum &lt;/b&gt;is simply &lt;p&gt; dummy text of the printing and typesetting industry.&lt;/p&gt; Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem 
       &lt;/p&gt;
</code></pre>

<p>My jquery function</p>

<pre><code>jQuery(function()
        { 
        var minimized_elements = $('p.descpara');

         var desc_minimized_elements = $('p.descpara');
        minimized_elements.each(function()
        {    
             var t = $(this).text();        
             if(t.length &lt; 300) return;

             $(this).html(
                 t.slice(0,300)+'&lt;span&gt;... &lt;/span&gt;&lt;a href="#" class="more"&gt;More details&lt;/a&gt;'+
                 '&lt;span style="display:none;"&gt;'+ t.slice(300,t.length)+' &lt;a href="#" class="less"&gt;Less details&lt;/a&gt;&lt;/span&gt;'
             );

         });  
         $('a.more', minimized_elements).click(function(event){
             event.preventDefault();
             $(this).hide("fast").prev().hide("slow");
             $(this).next().show("fast");        
         });

         $('a.less', minimized_elements).click(function(event){
             event.preventDefault();
             $(this).parent().hide().prev().show().prev().show();    
         }); 
       });
</code></pre>

<p>and in my view.php page</p>

<pre><code>   &lt;div class="products"&gt;
         &lt;div id="bookcont"&gt;
           &lt;?php echo"&lt;div id='btitle'&gt;$row-&gt;book_title&lt;/div&gt;&lt;/br&gt;";  
               echo "&lt;p&gt;by $row-&gt;auth_firstname   $row-&gt;auth_lastname&lt;/p&gt;"; ?&gt; 
             &lt;div class="detail"&gt; 

             &lt;!--  A long text paragraph, i am apply for this --&gt;
              &lt;p class="descpara"&gt;  
                   &lt;?php echo $row-&gt;description?&gt;
               &lt;/p&gt; 
         &lt;/div&gt; 
       &lt;/div&gt; 
</code></pre>

<h2>      </h2>

<p>Current output after apply code as said :
<img src="http://i.stack.imgur.com/KNYuE.png" alt="enter image description here"></p>
