That does it. I had never looked at the is method before Thanks a bunch
-----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Brandon Aaron Sent: Tuesday, April 17, 2007 10:26 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: hasClass This tripped me up a while back too. You can use the is method to test if an element is of a particular class. $('div.foo').is('.bar') The is method takes a simple selector and returns true or false. Here are the docs for the is method: http://jquery.bassistance.de/api-browser/#isString -- Brandon Aaron On 4/17/07, Geoffrey Knutzen <[EMAIL PROTECTED]> wrote: > > How can I test if an element has a specific class? > If I have > <div class="foo bar"> > > How can I check if the element has class=bar > > Seems like it should be easy, but I am having troubles. > > Thanks > -Geoff > >