Events
Last updated
Last updated
Two ways to interact:
generalized
Ex: e.addEventListener('click', handleClick);
specific on- handlers
only one on-event handler for a given event
Ex: e.onclick = handleClick
Call with e.onclick()
Print current function e.onclick.toString()
load | click | blur | error | focus | scroll | mouseover | keydown
Event handlers take an event parameter
Must have same arguments, so can't do anonoymous ft
Just overwrite ez
mouseover => enters the div or any of its child(div then child is twice triggered)
mouseenter => only when div first entered
mouseleave => only when div left
onmousemove => any movement over the div element.
Allows varius inputs like touchscreens, pens, etc
Supported in most browsers now even IE11
In react, onPointerDown or regular pointerdown. For backwards compatability, touch/pen events fire mouse events but a little late and a little unreliably
Use detail to hold extra information