tags:

views:

441

answers:

2

There is no such a "getElementsByClass" function in javascript,

then how does jQuery manage to do that?

Looping all elements will be too less efficient.

BTW,how to specify css to elements with two or more classes?

<a class="one two">test</a>

Guessing like below?

.one.two {...}

Is that right?

+2  A: 

The getElementsByClassName function exists, jQuery uses it internally if available, check the selector.js file on the jQuery source

To select elements with multiple classes use the .class.class selector:

$('.one.two')
CMS
Is ".one.two" and ".two.one" the same thing?
Shore
Yes, it's exactly the same, it will find elements with both classes.
CMS
+1  A: 

jQuery uses the Sizzle selector engine.

Andy Gaskell