You should not use href for JavaScript. Bad practice, instead use onclick and this
will magically point to the link.
<a href="#" onclick="foo(this)">click</a>
You also need to cancel the click action of the link. Either with return false or cancelling the event with preventDefault.
It is better to attach the event with Unobtrusive JavaScript