Q:

Where is the action listener registered?

I come across this problem when referring a piece of javascript code:
<a href="javascript:void(0);"><!-- other html elements --></a>

It wants to register a mouse click event listener on this anchor, but I cannot find which function is registered. What's more, what does the code href="javascript:void(0);" mean?
Thanks in advance!

A:

javascript:void(0) basically disables the href which is typically what you want to do if you need to add an event handler. Then inline on your  element you can add an onclick() handler IE:
<a href="javascript:void(0);" id="myA" onclick="myFunction()"><!-- other html elements --></a>

or you can register your event via script like:
document.getElementById('myA').onclick = myFunction;

Is that what you were asking?

