Hi, I'm trying to do this exact same thing, only in my case there ARE multiple classes assigned to the clicked element and I'd like to retrieve all of them. Is there an easy or recommended/standard jQuery way to do this? Is there a jQuery accessor that returns an array or collection of all the classes that a given element has assigned to it?
On Oct 31, 12:41 pm, Wizzud <[EMAIL PROTECTED]> wrote: > $(selector).click(function(){ > var equiv = $('#' + this.className); > if(equiv.length){ > // found element with relevant id, so now do something... > ; > } > > }); > > This is simplified, assuming that you don't have multiple classes on > anything that 'selector' assigns the click function to. > > On Oct 31, 6:19 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > Here's what I'm trying to do: > > When someone clicks on an element: jQuery will ask that element what > > it's class name is. > > Then jQuery will select another element whose ID is equivalent to the > > first element's class name. > > > I don't know how to get jQuery to ask the first element what its class > > is?- Hide quoted text - > > - Show quoted text -