HTML - How to attach onclick event to Anchor tag (a)
LIVE DEMO : Click this link for live demo
This is how you do it
<a href="javascript:void();" onclick="yourFunction();">Click me</a>
function yourFunction(){
// your code
window.alert("It works");
}
ALTERNATE TITLES