Why is id selector faster than class selector in jQuery?
+8
A:
The fastest selector in jQuery is the ID selector ($('#someid')). This is because it maps directly to a native JavaScript method, getElementById().
XGreen
2010-07-23 15:19:35
... and that method is bound to be faster than walking through an array of elements of a certain class.
Pekka
2010-07-23 15:24:19