Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: submit form after a value is selected from dropdown

I have this form in my HTML:

<form action="/awe/ChangeTheme/Change" method="post">      <select id="themes" name="themes">         ...         <option value="blitzer">blitzer</option>     </select>      <input type="submit" value="change" />  </form> 

Anybody knows how to submit it when a value is selected in the 'themes' dropdown?

like image 820
Omu Avatar asked Sep 29 '10 14:09

Omu


2 Answers

The other solutions will submit all forms on the page, if there should be any. Better would be:

$(function() {     $('#themes').change(function() {         this.form.submit();     }); }); 
like image 111
RoToRa Avatar answered Sep 18 '22 18:09

RoToRa


$('#themes').change(function(){     $('form').submit(); }); 
like image 30
Rocket Hazmat Avatar answered Sep 17 '22 18:09

Rocket Hazmat