>But that is my thinking of why $('span#bam') would be faster then just
>$('bam').

But getting an element by ID is much faster--because there's a native method
of retrieval. 

You're either selecting all <span /> tags and then looking to see which has
an ID of "bam", or your finding the first instance of "bam" and then
checking to see if it's a <span /> tag.

If you use "#bam" it uses document.getElementById("bam")--which is native to
the browser and uses a predefined map to the objects and returns the object
with little processing expense.

The other two methods require additional processing on the behalf of jQuery.

That's when my ID is unique, I use the simplest selector: "#bam".

-Dan 

Reply via email to