I need to have a handler on the calling object of onclick event.
<a href="123.com" onclick="click123(event);">link</a>
<script>
function click123(event) {
//i need <a> so i can manipulate it with Jquery
}
</script>
I want to do this without the use of $().click or $().live of jQuery but with the method described above.
pass in
thisin the inline click handleror use
event.targetin the function (according to the W3C DOM Level 2 Event model)But of course, IE is different, so the vanilla JavaScript way of handling this is
or less verbose
where
eis theevent objectthat is passed to the function in browsers other than IE.If you’re using jQuery though, I would strongly encourage unobtrusive JavaScript and use jQuery to bind event handlers to elements.