You can use the .is() method to check if an element has a particular
class like this.

$('#id').is('.someClass');

It will return true if it has that particular class and false if it doesn't.

The .is() method can also be used to check other things as well. Here
are the docs for the method.
http://jquery.bassistance.de/api-browser/#isString

--
Brandon Aaron

On 2/11/07, Tom Holder <[EMAIL PROTECTED]> wrote:
> How can I check to see if there is a particular css class on an element?
>
> Presumably I could just do $("#id").attr("class"); but I'm doing it in a
> loop where the class names have multiple classes on them and I only want to
> check for a specific one. Bith loathed to write a regexp for something so
> simple.
>
> Cheers
> Tom
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to