title: "undefined is not a function" error with "onchange" handler
body: <p>I have a drop-down (<code>&lt;select id="typeselect"&gt;</code>) with an inline <code>onchange</code> event handler to alert the selected option. Why do I get the error: <code>undefined is not a function</code>?</p>
  
  <p>Demonstration below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>(function($) {
  
    function test() {
      var selected_option = $('#typeselect option:selected');
      alert(selected_option);
    }
  
  })(jQuery);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;select id="typeselect" onchange="test()"&gt;
    &lt;option&gt;(Select)&lt;/option&gt;
    &lt;option value="oi"&gt;Outgoing invoice&lt;/option&gt;
    &lt;option value="ii"&gt;Incoming invoice&lt;/option&gt;
    &lt;option value="oc"&gt;Outgoing Credit Nota&lt;/option&gt;
    &lt;option value="ic"&gt;Incoming Credit Nota&lt;/option&gt;
  &lt;/select&gt;</code></pre>
  </div>
  </div>
  </p>