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?
<?php if($order == 1){ ?>
<li class="cat-one"><a href= "javascript:loadProducts($categoryId)" > <?php echo $categoryName ?> </a></li>
<?php } ?>
This is my JavaScript:
<script type="javascript" >
function loadProducts($categoryId)
{
alert("Hello World!");
return false;
}
</script>