Basically I use the addEventListener
function to bind events to an element. But you often see that events are created inline. So onclick="fnName(this)"
and onkeyup="fnName()"
etc.
Questions: Using the example <input onkeyup="fnName(this)" />
.
- is a new event now created for each letter or does the tag parameter onkeyup initialise the event once?
- Which variant needs less computing time? I assume that addEventListener is more perfomanant, isn't it?