jquery empty all forms
$('#formId')[0].reset();
OR
// For jQuery 1.6+:
$(':input','#formId')
.not(':button, :submit, :reset, :hidden')
.val('')
.prop('checked', false)
.prop('selected', false);
// For jQuery < 1.6:
$(':input','#formId')
.not(':button, :submit, :reset, :hidden')
.val('')
.removeAttr('checked')
.removeAttr('selected');
3.89
18
// Bind an event handler to the "click" JavaScript event
$('#clear').click(function(){
// Selects all elements of type text and clear all
$('#parent > input:text:not(".ignore")').val('');
// For excluding Multiple inputs
$("input:text:not('#objective_time_period, #subjective_time_period')").val('');
});
Example : http://jsfiddle.net/3zVyv/1/
Thank you!
18
0
4.33
3
$("#register").trigger("reset");
Thank you!
3
0
Are there any code examples left?
New code examples in category Javascript