HTML anchor tag with Javascript onclick event HTML anchor tag with Javascript onclick event javascript javascript

HTML anchor tag with Javascript onclick event


If your onclick function returns false the default browser behaviour is cancelled. As such:

<a href='http://www.google.com' onclick='return check()'>check</a><script type='text/javascript'>function check(){    return false;}</script>

Either way, whether google does it or not isn't of much importance. It's cleaner to bind your onclick functions within javascript - this way you separate your HTML from other code.


You can even try below option:

<a href="javascript:show_more_menu();">More >>></a>


From what I understand you do not want to redirect when the link is clicked.You can do :

<a href='javascript:;' onclick='show_more_menu();'>More ></a>