3 ms·
> But if, for some reason, you must target ancient browsers, such as IE8 (or older), you can use the following code to register for an event in any browser: An
by voidr 12y ago
> But if, for some reason, you must target ancient browsers, such as IE8 (or older), you can use the following code to register for an event in any browser:
And then the author proceeded to write a function that handles event listening.
And then there is the "Libraries to Consider".
It's ironic the the author demonstrates it clearly that the "modern Web API" is still not ready and we will still be using libraries like jQuery for the next couple of years.
> I fell into a trap, and this is a trap that many new, occassional, and hobbyist web developers fall into. Had I taken the time to understand JavaScript and the API provided by the browser first, I would have saved myself a lot of trouble.
This is the only justification we get from the author for not using jQuery. You can actually learn about the DOM and JavaScript while using jQuery, in fact you have to if you write anything that's more complicated then form validation.
I would say that the actual trap is not using jQuery, just because some people don't think it's "cool" anymore.
Also using jQuery doesn't mean that you cannot the DOM API directly if it makes sense.