I have a page displaying text in html entity into a div node, like below one:
<p>isdjf</p>osdf&kdjf;'ldsf."jdof&ids
want to truncate it to 10 letters length in js, but want to avoid break html entities, how to achieve that correctly? substr?
html entity break is as below:
var str = '0123456>abc';
console.log( str.substr(0,10) ); // -> "0123456&#x"
Do you see the problem?