What are the differences between .addEventListener("resize",function(){}) and .onresize = function(){} ?
- learn.javascript.ru/introduction-browser-events - Alex Obukhov
|
1 answer
addEventListener allows you to add multiple handlers for a single action. Conveniently, if you use third-party libraries and cannot be sure that no one else except you has installed its handler.
- And what are the names of methods like .onresize (well, there are EventListeners, but what is this?). - user323354
- Himself onresize and similar ones are called events. The functions that you put in them are event handlers. - German Borisov
|