Posted By

mattvbiggs on 12/13/12


clear text fields

Versions (?)

jQuery: Clear All Text Fields (with one line of code)

 / Published in: jQuery

This can come in handy for a reset or cancel button. You can clear all inputs within a single div in one line of code. Pretty sexy.

  1. // "inputfields" is the id of the div that contains the text fields.
  3. $('div[id=inputfields] input[type=text]').val("");

Report this snippet  

You need to login to post a comment.