<a id="test" class="target1 target2">test</test>
How to know whether $("#test") has applied .target2 or not?
<a id="test" class="target1 target2">test</test>
How to know whether $("#test") has applied .target2 or not?
use jQuery hasClass
if( $("#test").hasClass("target2") )
{
// yep, it has...
}
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(...);