How can I add custom text to already written text in textarea using javascript??Thanks...
A:
Grab the existing text in the textarea (the element's .value)
Combine your existing text (append, prepend, insert, or whatever you need)
Write the result back to the textarea.
Tah-dah!
timdev
2009-09-16 00:44:29
+2
A:
function addText(elId,text) {
document.getElementById(elId).value += text;
}
or:
function addText(elId,text) {
var obj = document.getElementById(elId);
var txt = document.createTextNode(text);
obj.appendChild(txt);
}
karim79
2009-09-16 00:50:29
elId is the id="" of the <textarea>....right
halocursed
2009-09-16 00:56:34
Oh!I got it...Thanks
halocursed
2009-09-16 00:58:06