title: Run javascript function if option selected
body: <p>If I have a select like this </p>
  
  <pre><code>&lt;select id="selectid" name="selectname" onchange="jsfunc1()"&gt;
      &lt;option value="val1" id="valid1"&gt; Val1 &lt;/option&gt;
      &lt;option value="val2" id="valid2"&gt; Val2 &lt;/option&gt;
      &lt;option value="val3" id="valid3"&gt; Val3 &lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I now have a javascript function <code>func2</code>, say, that need to do something if option <code>val1</code> is selected. How do I do that? </p>
  
  <p>For example, </p>
  
  <pre><code>function func2(){
      ....
      if(document.getElementById('valid2').selected==True){
          //Do something 
      }
  }
  </code></pre>
  
  <p>I'm not getting the exact syntax right and that's where I need your help.</p>