tags:

views:

29

answers:

2
<a id="test" class="target1 target2">test</test>

How to know whether $("#test") has applied .target2 or not?

+4  A: 

use jQuery hasClass

if( $("#test").hasClass("target2") ) 
{
    // yep, it has...
}
balexandre
A: 

Do you really want to know or do you want to do something if it has?

In the latter case, this will do nicely:

$("#test.target2").doWhateverYouWantToDo(...);
fransre