How do I call a JavaScript function from href tag in html? I've created a few tabs and when a user clicks on one of them the href along with JavaScript function should get called.
<?php if($order == 1){ ?>
<li class="cat-one">
<a href="javascript:void(0)" onclick="loadProducts(<?php echo $categoryId ?>)">
<?php echo $categoryName ?>
</a>
</li>
<?php } ?>
This is my JavaScript:
function loadProducts($categoryId)
{
alert("Hello World!");
return false;
}
Why doesn't the alert trigger in my function? I am running 2 jQueries on the same page.