Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
37
rated 0 times [  41] [ 4]  / answers: 1 / hits: 136200  / 13 Years ago, wed, august 31, 2011, 12:00:00

I have a form with a select and a few text inputs. I'd like the form to be submitted when the select is changed. This works fine using the following:



onchange=this.form.submit()


However, if the form also contains a submit button, then the form does not submit when the select is changed. I'm guessing some kind of conflict.



What are my options here?



Should I use something like
$(this.form).trigger(submit)
instead?


More From » jquery

 Answers
6

You should be able to use something similar to:



$('#selectElementId').change(
function(){
$(this).closest('form').trigger('submit');
/* or:
$('#formElementId').trigger('submit');
or:
$('#formElementId').submit();
*/
});

[#90326] Tuesday, August 30, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brodyfrancisi

Total Points: 1
Total Questions: 102
Total Answers: 89

Location: Marshall Islands
Member since Mon, May 31, 2021
3 Years ago
brodyfrancisi questions
;