top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

+4 votes
1,282 views
Which is fast document.getElementByID('txtName') or $('#txtName').?
posted Jul 8, 2015 by Shivaranjini

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

Faster: document.getElementByID('txtName');
because
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.

answer Feb 12, 2016 by Shivam Kumar Pandey
...