Recommendations on Triming Large Amounts of Text from a DOM Object
- by aronchick
I'm doing some in browser editing, and I have some content that's on the order of around 20k characters long in a <pre>.
So it looks something like:
<pre>
Text 1
Text 2
Text 3
Text 4
[...]
Text 20,000
</pre>
I'd like to use jquery to trim it down when someone hits a button to chop, but I'm having trouble doing it without overloading the browser. Assume I know that the character numbers are at 16,510 - 17,888, and what I'd like to do is trim it.
I was using:
jQuery('#textsection').html(jQuery('textarea').html().substr(range.start));
But browsers seem to enjoy crashing when I do this. Alternatives?