The javascript code is like below.
var ADDRESS = {
checkit : function(element){
if(event.target.className == "delete"){
doSomethingweird();
} else {
doSomething();
}
}
and the calling function looks something like below.
<div onclick="ADDRESS.checkit(this);">
<div class="delete">del</div>
</div>
Apparently, only input ‘this’ gets passed in, but I want to also pass in the event such that I can use it to find out the event.target.className.
(Above code works in Chrome, but not in IE so far, because IE does not seem to recognize event)
How should I change ADDRESS.addressbook_clicked(this); so that event also gets passed in?
Your HTML should be
Now the event element is also being passed to your event handler.
Warning
This is old style event handling, most people nowadays use non-obtrusive event handling which decouples your JS and your HTML.