What is more effective way to get an element by id (if its id is unique)?
#id
or
#div1 #id
or
span#id
and why?
Could you please tell me where I can read about such things?
(How to use jQuery selectors faster and more effectively and why exactly so)
Thank you!
#id// most efficient way to get an element by Id in jQueryid’s of HTML elements are suppose to be unique and because of this jQuery will make use of
document.getElementById()instead ofdocument.getElementsByTagName()and iterate though the array of elements searching for the correct one.