Jump to content

How to set the text of a textarea tag?


Betty_S

Recommended Posts

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=””;

But it failedWhat to do?Thanks.

Link to comment
Share on other sites

I think there is a problem with the quotesyou should use " " or ' ' instead of ”” and ’’also the textarea should have an id by which you can use getElementByIdhere is an example

<html><body><textarea id='test'>aksjdhkajhdjkas</textarea><br><input type='button' onclick="document.getElementById('test').value='';"  value='clear'></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...