In my javascript code, I want to clear the text fields after done with the operations using onclick command. Question: Is there a predefined fuction to serve this purpose?
hastings.george.5 0 Newbie Poster
Recommended Answers
Jump to PostIf the initial values when the page is parsed are blank, you can use the .reset() method of the FORM (not the individual inputs), which should revert everything back to what the values were at page render.
If you don't have a form, or are looking for a specific input …
Jump to Posthi nblan180131,
if it is a <textarea>, in javascript you can go:
document.getElementById("textarea1").innerHTML = "";using
document.getElementById("textarea1").value = "";
works perfectly for textarea.Hi hastings.george.5,
I would suggest you use the reset button for form on HTML, since you would probably have more than one text field.
All 5 Replies

RudyM
ryantroop 177 Practically a Master Poster
mblan180131 0 Light Poster
2teez 43 Posting Whiz
hastings.george.5 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.