0

I'd like to submit the form when #pname is changed. How can I add submit form to the below?

jQuery(function(){
    jQuery('#pname').on("change", function(){
    var property = jQuery('#pname option:selected').text();
    if (property != 'Any') {
        jQuery('#s').val('Submit1');
    }
    else {
        jQuery('#s').val('');
    }
});

Could I do something like this?

jQuery(function(){
jQuery('#pname').on("change", function(){
var property = jQuery('#pname option:selected').text();
if (property != 'Any') {
    jQuery('#s').val('Submit1');
    jQuery('#s').submit();
}
else {
    jQuery('#s').val('');
}
});

Form id is "s" and dropdown menu is pname.

vic_e
  • 21
  • 3
  • 1
    Can you show the correspondent html-code? –  Jun 24 '15 at 15:03
  • Just testing: http://jsfiddle.net/pjg9f8nc/ –  Jun 25 '15 at 01:07
  • _How to submit a form using jQuery/Ajax?_ was answered here: http://stackoverflow.com/questions/1200266/submit-a-form-using-jquery –  Jun 25 '15 at 01:09

0 Answers0