title: Getting the value of form select input returns "undefined"
body: <p>I have this html form code:</p>
  
  <pre><code>&lt;form&gt;
      &lt;select id="sex" name="sex" onchange="alert($('#sex').val())"&gt;
          &lt;option value="0"&gt;Male&lt;/option&gt;
          &lt;option value="1"&gt;Female&lt;/option&gt;
      &lt;/select&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Maybe I use the jquery syntax to retrieve the value incorrectly, but when the select is changed, a message box show up with message "undefined". I expect the result will be either 0 or 1, or at least "Male" or "Female". Not "undefined". What have I done wrong?</p>
  
  <p><a href="https://learn.jquery.com/using-jquery-core/faq/how-do-i-get-the-text-value-of-a-selected-option/" rel="nofollow">https://learn.jquery.com/using-jquery-core/faq/how-do-i-get-the-text-value-of-a-selected-option/</a></p>