I'm writing a function that slices up chunks of text into 1000 character blocks. Before it does that however, I'd like to remove all instances of the string '[edit]'. For some reason, the code below is not doing it for me. What am I doing wrong? (for the whole code string, http://jsfiddle.net/ayoformayo/yTcRb/13/)
function cutUp(){
var PAname= prompt("Determine PA type and PA Name");
var chunks = [];
var OGstring = document.getElementById('PATypes').value;
var my_long_string = OGstring.replace("[edit]","");
var i = 0;
var n = 0;
while(n < my_long_string.length) {
chunks.push(my_long_string.slice(n, n += 1000));
}
document.getElementById('PAType=Name=Value4').innerHTML = PAname + chunks[0];
document.getElementById('PAType=Name=Value5').innerHTML = PAname + chunks[1];