I have heard that querySelector
and querySelectorAll
are new methods to select DOM elements. How do they compare to the older methods, getElementById
and getElementsByClassName
in terms of performance and browser support?
How does the performance compare to using jQuery's query selector?
What is the difference between querySelector
and getElementById
?
When should we use querySelector
instead of getElementById
? Is there any example which is not possible using getElementById
?