What is the best jquery codes to make the more less link feature?

Hello folks!
I have recently searched a more less link codes using jquery that I used for my comment section page.I used to store the comments and replies into my database before displaying it in <p> element. Now I noticed that if your comments and replies that are stored in the database doesn’t come along with this line <br/><br/> using the code below won’t recognize the <br> or new line on my comments or replies unless your comments or replies stored in your database come along with this string <br/><br/&gt because it is affected by the more less link codes below; but instead it will just display a compressed one long paragraph. The reason why I bring this up in forum because I want to display the comments and replies in correct format, that if the user would enter a multi-paragraph comments or replies it should display the multi-paragraph content and in this case if I used the codes below it will bypass the new line which separates the paragraph but instead it will just compressed in one long paragraph.My question is what is the best code aside from the code below that you can use a More Less link feature without ruining the a multi-paragraph comments or replies if it has no <br/><br/> on the database?
Thanks here’s the code below I used:


$(function () { //use class="minimize" for class of the element

     var minimized_elements = $('p.minimize');

     minimized_elements.each(function () {
         var t = $(this).text();

         if (t.length < 252) return;

         $(this).html(

             t.slice(0, 252) + '<span class="showcontent" ></span><a href="#" class="more">...More </a>' +
             '<span style="display:none;">' + t.slice(252, t.length) + ' <a href="#" class="less">Less </a></span>'

         );

     });
     
     $('a.more', minimized_elements).click(function (event) {

         event.preventDefault();
         $(this).hide().prev().hide();
         $(this).next().show();


     });

     $('a.less', minimized_elements).click(function (event) {

         event.preventDefault();
         $(this).parent().hide().prev().show().prev().show();

     });
     
 });