I have function which needs to be run on click event. However it is working fine with onclick attribute of anchor tag but not working with HREF attribute. It is giving id undefined. Here is demo code
HTML
<a href="javascript:test(this)" id="first">click</a>
JS
function test(obj){
alert(obj.id)
}
thisin that context is thewindow, not the control. It's not the same an event handler. Here's a fiddle.