Ad Code

jQuery: submit form after a value is selected from dropdown

I have this form in my HTML:

<form action="/awe/ChangeTheme/Change" method="post" name="myForm" id="myForm">

    <select id="theme" name="theme">
        <option value="blitzer">blitzer</option>
    </select>

    <select id="author" name="author">
        <option value="blitzer">blitzer</option>
    </select>

</form>

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


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

$(document).ready(function() {
  $('#theme, #author').on('change', function() {
     document.forms['myForm'].submit();
  });
});

 


 

Post a Comment

0 Comments