title: Is there a way to select HTML <option> automatically with a javascript injection?
body: <p>Let's say I have a form on a web page with this HTML</p>
  
  <pre><code>&lt;form id="form" method="post"&gt;
      &lt;select id="selectThis"&gt;
          &lt;option id="one" value="1"&gt;1&lt;/option&gt;
          &lt;option id="two" value="2"&gt;2&lt;/option&gt;
          &lt;option id="three" value="3"&gt;3&lt;/option&gt;
          &lt;option id="four" value="4"&gt;4&lt;/option&gt;
      &lt;/select&gt;
      &lt;a href="gothispage.com" onclick="ajaxSubmitFunction('submit') id="submit"&gt;submit&lt;/a&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Is there a way to inject a js code that does basically this.</p>
  
  <pre><code>function selectOption(option) {
      var a = document.getElementById(option);
      a.selected = selected;
      if (a === "selected") {
          document.getElementById("submit").click();
      }
  }
  selectOption("four");
  </code></pre>
  
  <p>Is this the correct way of thinking about how to approach this problem?</p>