3 ms·
> $("#something") instead of document.getElementById("something") or even just document.querySelectorAll("#something")
by jeena 13y ago
> $("#something") instead of document.getElementById("something")
or even just document.querySelectorAll("#something")
- davej 13y agoYou lose some browser compatibility with qSA, whereas gEBId works everywhere. You need IE8+ for qSA, and you need to ensure the page isn't in quirks mode. If you're OK with that then you can also do: var $ = document.querySelectorAll. Probably best to do this within a closure so that you're not hijacking any jQuery instances that may be on the page.