title: How to call a Javascript function onselection of menuitem?
body: <p>How can I call a Javascript function <code>test()</code> as below for the <code>onselect</code> event (upon selection of menu item) of a menu item as for my below code?</p>
  <p>I have always worked on <code>OnClick</code> event in button but I have no idea about <code>OnSelect</code> events for the menuitems, how to call a function onselection of menuitem.</p>
  <p>Can anyone suggest how can my code below work and call my function <code>test()</code> <strong>(code 1)</strong> on selection of menu item named <strong>Log Report</strong> as in  <strong>code-2</strong>?</p>
  <pre><code>&lt;ul&gt;
  &lt;li&gt;Log Report&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  <p><strong>Code-1</strong></p>
  <pre><code>&lt;script&gt;
  function test() {
      window.open(&quot;www.google.com&quot;);
  }
  &lt;/script&gt;
  </code></pre>
  <p><strong>Code-2</strong></p>
  <pre><code>&lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;title&gt;Test screen&lt;/title&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css&quot;&gt;
  &lt;script src=&quot;http://code.jquery.com/jquery-1.10.2.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;http://code.jquery.com/ui/1.11.0/jquery-ui.js&quot;&gt;&lt;/script&gt;
  &lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;
  &lt;script&gt;
  $(function() {
  $( &quot;#menu&quot; ).menu();
  });
  &lt;/script&gt;
  &lt;style&gt;
  .ui-menu { width: 230px; }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;ul id=&quot;menu&quot;&gt;
  &lt;li&gt;Database&lt;/li&gt;
  &lt;li&gt;Log
  &lt;ul&gt;
  &lt;li&gt;Log Report&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/li&gt;
  &lt;/html&gt;
  </code></pre>