views:

22

answers:

2

I have a function that takes an element, and then shows all the other elements that have the same class. I know how to show the elements of a give class, but I dont know how to find out what the class of the given element is. Any ideas? I've looked at the docs quite a bit, but I'm not seeing anything.

+1  A: 

Nevermind. elem.attr("class") does the trick. I feel kinda silly; sorry to bug you all.

Esteban Araya
A: 

To see all of the classes applied to an element just retrieve the value of the class attribute. This can be accomplished by using the .attr() method. For a div that would look like div.attr('class').

ahsteele