You could also use one of the attribute selectors to filter a set of
matched elements. If you don't care where the particular value
appears within the class attribute, you could do this:
$('[EMAIL PROTECTED]')
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Feb 11, 2007, at 2:16 PM, Brandon Aaron wrote:
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
discuss@jquery.com
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/