Lonce Wyse
Communication & New Media
lonce.wyse@cnm.nus.sg
var myButton = document.getElementById("buttonID");
myButton.addEventListener("click", function( ev ) {
alert( "got a button press!");
}
);
What useful properties does that object have for us?
the html element that generated the event
Event.target
Of course, we can access all of its prperties
element.addEventListener("click", function( ev ) {
var targetElement = ev.target;
alert( "The value of the element clicked is "
+ targetElement.value);
}
);
for "click", "mousedown", "mousemove", "mouseup"
MouseEvent properties include