Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
121
rated 0 times [  122] [ 1]  / answers: 1 / hits: 18253  / 8 Years ago, wed, august 3, 2016, 12:00:00

I have a form with multiple input checkbox fields. I want to trigger form submit on change in any of the checkbox without submit button.



<form action= method=get>
<input type=checkbox name=p[] value=1>
<input type=checkbox name=p[] value=2>
<input type=checkbox name=p[] value=3>
</form>


How it can be done with jQuery?


More From » jquery

 Answers
23

You could hook to the change() event of the checkboxes, then fire a submit() on the parent form, like this:


$('form input').on('change', function() {
$(this).closest('form').submit();
});

[#61165] Monday, August 1, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaliyahcynthiac

Total Points: 91
Total Questions: 94
Total Answers: 119

Location: Vanuatu
Member since Wed, Oct 14, 2020
4 Years ago
;