Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
110
rated 0 times [  112] [ 2]  / answers: 1 / hits: 27226  / 10 Years ago, wed, january 7, 2015, 12:00:00

Does Bootstrap offer anything for clearing form input fields via a button?



Or do I need to roll my own through jquery?



From this post jQuery Validate resetForm() doesn't reset the onFocus validation, there seems to be a resetForm() method coming from jquery but I always get a object doesn't support method when I try to access that method.


More From » jquery

 Answers
69

You can use reset method (this is DOM element method, it is not jQuery object method), like this



$('form').get(0).reset() // or $('form')[0].reset()

[#68286] Sunday, January 4, 2015, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaredsages

Total Points: 273
Total Questions: 97
Total Answers: 105

Location: French Southern and Antarctic Lands
Member since Fri, Jan 6, 2023
1 Year ago
jaredsages questions
;