title: Next button to select next option of drop down menu with js
body: <pre><code>&lt;select id="form"&gt;
      &lt;option value="1" &gt;1 &lt;/option&gt;
      &lt;option value="2" &gt;2 &lt;/option&gt;
      &lt;option value="3" &gt;3 &lt;/option&gt;
  &lt;/select&gt;
  &lt;button id='next'&gt;Next&lt;/button&gt;
  &lt;script&gt;
      var select2 = document.getElementById("form");
      var lastselected2 = localStorage.getItem('select2');
      document.getElementById('next')
              .addEventListener('click', function(){
                    lastselected2 = parseInt(lastselected2) + 1;
              });
  
      if(lastselected2) {
          select2.value = lastselected2; 
      }
  
      select2.onchange = function () {
          lastselected2 = select2.options[select2.selectedIndex].value;
          console.log(lastselected2);
          localStorage.setItem('select2', lastselected2);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>I've this code that saves the selected of the dropdown and I wanted to add a button that can select the next option of the dropdown.</p>