Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any function can auto clear the text box?

 
Phoebe Song
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I'm new to Javascript, right now I'm doing a project that when you click on the "new" button, the text in the text box and text area will disappear. Is there any javascript function can do the trick or should I coding myself? Thank you for your help.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll pretty much have to do that yourself. You could use the built in reset() function, but that will return the form to it's original state. The problem with that is if you have the form populated with any data when the page loads, reset() will just put it back to that. If your form always starts completely blank, then you can probably get away with using reset() though.
 
Phoebe Song
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic