I want to add a "<br />
" tag to my html using jQuery after the html exceeds 50 characters.
My HTML:
<table>
<tr>
<td class="ccol1">This is the HTML if its characters exceed 50 characters it should go to next line</td>
</tr>
</table>
I attempted to do this using results from google but it doesnt seem to work.
$( '.ccol1' ).each( function () {
var str = $('td' + '.ccol1');
var htmlfoo = str.match(/.{1,50}/g).join("<br/>");
$( this ).html( str );
});
Also, I have to do this using jQuery alone so please dont suggest using CSS word-wrap.
Thanks