php - clearing/refreshing all the fields using onchange event in JQuery -
i have set of code, in have drop down list, , have 6-8 text fields below it. whenever change option, want fields refreshed, mean fields must made empty....
what have tried:-
$(document).ready(function(){ $('#typed').change(function() { $('#fieldid1').val(""); $('#fieldid2').val(""); .... }) });
but question can done using single line of code such textboxes present cleared ????
try this:
$('#typed').change(function () { $('input:text').val(""); });
also, can put class input fields want clear , follows:
$('#typed').change(function () { $('input.someclass').val(""); });