views:

570

answers:

3

I've got some links that I want to select class and id at the same time.

This is because I've got 2 different behaviours. When a class of links got one class name they behave in one way, when the same clas of links got another class name they behave differently. The class names are switch with jquery.

So I have to be able to select a links class AND id at the same time. Is this possible?

I've tried:

 $("a .save #country")

without any result.

A: 

How about

$("a.save#country")

?

Pekka
A: 
$("a.save, #country")

will select both "a.save" class and "country" id.

o.k.w
+3  A: 

You can do:

$("#countery.save")...

or

$("a#country.save")...

or

$("a.save#country")...

as you prefer.

So yes you can specify a selector that has to match ID and class (and potentially tag name and anything else you want to throw in).

cletus