Others



How to submit form Using onchange with JavaScript


The following example shows, how to submit HTML Form Using JavaScript when the user change a options in select Tag.

Example
<html>
  <body>
    <form method='get' action='' id='frm'>
      <select id='month' name='month'>
        <option value='Jan'>Jan</option>
        <option value='Feb'>Feb</option>
        <option value='Mar'>Mar</option>
        <option value='Apr'>Apr</option>
      </select>
    </form>
    <script>
      document.querySelector("#month").onchange=function(e){
        document.querySelector("#frm").submit();
      }
    </script>
  </body>
</html>