Hi, Believe you me, I triad to find the answer myself because its really shouldn’t be a big deal but I just couldn’t clean the text of the my textarea tag. I triad document.formName.textareaName.value=’’; document.getElementById(“textareaIdâ€).value=â€â€; Code (markup): But it failed What to do? Thanks.
Please don't take this the wrong way, but do you have a class set for it in your CSS? If you do, I think the cascade will overwrite the javascript setting the value to "empty". Morty
There is no problem with your script. Check whether you have the readonly attribute set in the html code. if that too doesn't work, try alerting the textarea object to make sure that the element exists or not. alert(document.formName.textareaName); Code (markup): If you get undefined, then the object doesn't exist. If you get no alert box, then there is some problem with the code prior to it. If you want further help, post the entire code or the link to the page here.
Try this: if ( document.getElementById(“textareaIdâ€).firstChild ) { document.getElementById(“textareaIdâ€).firstChild.data = ""; } Code (markup):
phper seems to be on the right track (I think that's fireFox support no?). Also you may consider: <textarea id="textareaId">yadayada</textarea> ... ... ... document.getElementById('textareaId").innerText = 'nothing'; OR document.getElementById('textareaId").innerHTML = 'nothing';