You shouldn't use the DOM level 1 event attributes (on...) anymore, but instead use the recent UI Events (node.addEventListener('...', (ev) => {})). Only if you're using a framework like React or Vue, then what looks like event attributes is already translated into internal handling of UI Events.
You cannot have multiple events then. If you set the DOM level 1 event after a UI Event, the latter will be overwritten. You don't get access to the event object. Finally, you either need to add JS code directly to the HTML or have global variables lying around, which is a bad idea either way.
You shouldn't use the DOM level 1 event attributes (
on...
) anymore, but instead use the recent UI Events (node.addEventListener('...', (ev) => {})
). Only if you're using a framework like React or Vue, then what looks like event attributes is already translated into internal handling of UI Events.What problems do we face using events with 'on' prefix?
You cannot have multiple events then. If you set the DOM level 1 event after a UI Event, the latter will be overwritten. You don't get access to the event object. Finally, you either need to add JS code directly to the HTML or have global variables lying around, which is a bad idea either way.
Thank you for pointing that out. Helps put everything in perspective.