Which is fast document.getElementByID(‘txtName’) or $(‘#txtName’).?

Technology CommunityCategory: jQueryWhich is fast document.getElementByID(‘txtName’) or $(‘#txtName’).?
VietMX Staff asked 3 years ago

Native JavaScipt is always fast. jQuery method to select txtName “$('#txtName')” will internally makes a call to document.getElementByID('txtName'). As jQuery is written on top of JavaScript and it internally uses JavaScript only so JavaScript is always fast.