3 ms·
Listeners are complicated, but .onclick and friends work everywhere and always have.
by TazeTSchnitzel 11y ago
Listeners are complicated, but .onclick and friends work everywhere and always have.
- acdha 11y agoFor the simplest cases, yes, but even there you could easily find oddities with things like cancellation, bubbling, timing with regards to other events, support for various element types, etc. Here's a whole list just for click, which is probably the most standardized event handler, and doesn't even go back before the IE5.5 era: http://quirksmode.org/dom/events/click.html http://quirksmode.org/dom/events/click.html
- LoSboccacc 11y agoto double down, touch events on mobile browsers are in a different order than mouse event in regards of onclicks, so that a touchend and mouseup fire at the opposite side of the click event on some mobile browser but not all.
- untog 11y agoUntil you want to add more than one onclick event.