Page 1 of 1

[SOLVED]CSS class selector.

Posted: Wed Jan 09, 2008 9:56 pm
by JellyFish
What CSS class selector does jQuery support that allows me to select an element with two classes? For example let's say I had multiple elements that have the class "top". And in that set of elements each has the class "left", "center" and "right", respectfully. How would I select the element that has both the "top" class and the "center" class?

Code: Select all

$(".top left")
This doesn't really cut the cake.

Is there a way to do this?

Re: CSS class selector.

Posted: Thu Jan 10, 2008 10:19 pm
by RobertGonzalez
What you are doing should work, just remember to reference them correctly, using the . before the class name for both.

Re: CSS class selector.

Posted: Fri Jan 11, 2008 1:07 am
by Kieran Huggins

Code: Select all

$(".classone.classtwo")
Check out http://docs.jquery.com/Selectors for more

Re: CSS class selector.

Posted: Tue Jan 15, 2008 12:02 am
by JellyFish
Kieran Huggins wrote:

Code: Select all

$(".classone.classtwo")
Check out http://docs.jquery.com/Selectors for more
Thanks Kieran, this is what I was looking for.