Reputation:
I'm trying to loop through all visible inputs within a form and set their value to be empty. What I have doesn't seem to work for text inputs, it returns undefined. Any ideas how to do this?
Upvotes: 0
Views: 1732
Reputation: 119877
jQuery has a :visible
selector as well as an :input
selector. In addition, most jQuery methods operate on the entire set. val()
can be used directly rather than looping through the set.
currentForm.find(':input:visible').val('');
Upvotes: 2
Reputation: 731
Textbox inputs would have a tagName of "textarea". Not sure why the other text types aren't working. Have you tried:
childs[i].values = '';
?
Upvotes: 0