Right from the docs http://docs.jquery.com/Attributes/hasClass#class --------------------------------------------------------------- Returns true if the specified class is present on at least one of the set of matched elements ---------------------------------------------------------------
So say you have an element, let's say: <div id="SomeDiv"></div> and you we wondering if it has "SomeClass", then: $("#SomeDiv").hasClass("SomeClass") would be "false" with that said though, if you are just going to say: $("#SomeDiv").addClass("SomeClass"); then there's no need to check if it has the class already or not, it's not going to be applied twice On Oct 21, 2:49 pm, kgosser <[EMAIL PROTECTED]> wrote: > Hey all, > > I understand how hasClass() works, but I'm trying to figure out how to > use it to see if an element DOESN'T have a class. I want to check if > the class doesn't exist, and if not then I'll add it. > > Do I use the older is() method? > > Just looking for the best way. Thanks!