InterviewSolution
Saved Bookmarks
| 1. |
Which one is more efficient, document.getElementbyId( "idname") or $("#idname)? |
|
Answer» The document.getElementbyId( "ourID") is faster because it calls the JAVASCRIPT engine directly. jQuery is a wrapper that standardizes DOM control such that it works reliably in each significant browser. A jQuery object is built by the $ SIGN, and it will first parse the selector as jQuery can search things via attribute, class, etc. The document.getElementbyId can only FIND the ELEMENTS by the id. A jQuery object is actually not a native object so it takes time to create one and it additionally has considerably more potential. |
|