clearing the form element using jquery -


i have form id='form_testimonial'. here code clear form element

$(':input,:hidden','#form_testimonial')  .not(':button, :submit, :reset')  .val(''); 

it clear value input select option value too, don't want clear values of select option.

simply use this:

$('#form_testimonial input[type="text"]').val(''); 

if want include hidden inputs too:

$('#form_testimonial').find(input[type="text"],input[type="hidden"]').val(''); 

you can use:

$('#form_testimonial input').filter(function(){     return this.type == "hidden" || this.type == "text"; }).val(''); 

Comments

Popular posts from this blog

php - Dynamic url re-writing using htaccess -

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -