title: How to call a JavaScript Function from href tag in html?
body: <p>How to call a JavaScript Function from href tag in html? I have created few tabs. I want when user clicks on any tab the href along with JavaScript function should get called. How can I do it?</p>
  <pre><code>&lt;?php if($order == 1){ ?&gt;
  &lt;li class=&quot;cat-one&quot;&gt;&lt;a href= &quot;javascript:loadProducts($categoryId)&quot; &gt; &lt;?php echo $categoryName ?&gt; &lt;/a&gt;&lt;/li&gt;
  &lt;?php } ?&gt;
  </code></pre>
  <p>This is my JavaScript:</p>
  <pre><code>&lt;script type=&quot;javascript&quot; &gt;
  function loadProducts($categoryId)
  {
      alert(&quot;Hello World!&quot;);
      return false;
  }
  
  &lt;/script&gt;
  </code></pre>