var classes = $(this).attr('class').split(' '); // this gets the current element classes var classes = $(this).parent().attr('class').split(' '); // this gets the parent classes.
The parent in the above situation is ankor.
If I wanted to get the first parent DIV from $ (this), what would the code look like?
var classes = $(this).div:parent().attr('class').split(' ');
* Basically, I want to get the classes of the first parent DIV from $ (this).
THX
javascript jquery css-selectors
Adam Aug 17 '11 at 7:27 2011-08-17 07:27
source share