title: Adding Option to Drop Down Value if it doesn't exist?
body: <p>How can the code below be modified so as to allow a new value to be added to the drop down list, should the specified value not be found in the found in the drop down box?</p>
  
  <p>Right now, I use the given function below to find a given value (option_name) in a drop down box.</p>
  
  <p>I'd like to modify the negative flag (!flag) so as to instead of alerting me that it not has found the option_name, to basically add the new option_name in the existing drop down list.</p>
  
  <p>ie.</p>
  
  <pre><code>get_position( 'drop', 'flower' ) 
  
  
  &lt;select id="drop" style="width: 200px;"&gt;
      &lt;option value="0"&gt;&lt;/option&gt;
      &lt;option value="1"&gt;apples&lt;/option&gt;
      &lt;option value="2"&gt;oranges&lt;/option&gt;
      &lt;option value="3"&gt;pears&lt;/option&gt;
      &lt;option value="4"&gt;mangos&lt;/option&gt;
      &lt;option value="5"&gt;bananas&lt;/option&gt;
      &lt;option value="6"&gt;kiwis&lt;/option&gt;
  &lt;/select&gt;
  
  function get_position(id,option_name) {
  
      var flag = false;
  
      for ( var i=0; i &lt;= document.getElementById(id).options.length - 1; i++ ) {
  
          if (document.getElementById(id).options[i].text === option_name)  {
  
              document.getElementById(id).selectedIndex = i; 
              flag = true;
  
          }
      }
  }
  </code></pre>