Tuesday, 28 May 2013

How do I add two texts into one text area?

How do I add two texts into one text area?

I want to insert two texts into one text area using javascript.
I am getting plain text from Wikipedia but I can't seem to two or more article sections into the text area.
I use the code bellow for inserting the text for both sections into the text area.
pText = pText.substring(0, pText.length - 2); //Remove extra newline
pText = pText.replace(/\[\d+\]/g, ""); //Remove reference tags (e.x. [1], [4], etc)
document.getElementById('textarea').value = pText
http://jsfiddle.net/LUTW4/

No comments:

Post a Comment