html - jQuery add a to text after 50 characters -
I use the tag "html" on the tag " My HTML: I tried to use Google's results but it does not seem to work. Besides, I only want to do this using jQuery, please do not use CSS word-wrap. Thanks Here is a JSFiddle link based on your existing code. As the code snippet Note that
> After adding HTML to more than 50 characters
& lt; Table & gt; & Lt; TR & gt; & Lt; Td class = "ccol1" & gt; If it is 50 characters in its characters then it should go to the next line & lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt;
$ ('.ccol1') .each (function () {var str = $ ('td' + '.ccol1'); var htmlfoo = str.match (/. {1 , 50} / g) .join ("& lt; br / & gt;"); $ (this) .html (str);});
$ ('ccol1'). Each (function () {var str = $ (this) .html (); var htmlfoo = str.match (/. {1,50} / g) .joint ("& lt; br / & gt;"); $ (This) .html (htmlfoo);}); var str = $ (this) .html (); which refers to the element in every ,
Comments
Post a Comment