From my experience I know three different ways to execute a Javascript function when a user clicks on a link
Use the
onclickattribute on the link<a href="#" onclick="myfunction();return false;">click me</a>Use the
hrefon the link<a href="javascript:myfunction();">click me</a>Don't touch the link, do everything in js
<a href="#">click me</a>(in the Javascript we will stop the default event, and call the function)
Which one is better? What are the advantages and disadvantages?
EDIT deleted the "javascript:" on onclick