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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -