views:

649

answers:

1
+7  A: 

Try this:

$(".meuble-tab").parent("li").addClass("active");

For reference, please see parent( [expr] ):

Get the direct parent of an element. If called on a set of elements, parent returns a set of their unique direct parent elements.

You may use an optional expression to filter the element(s). If there is no parent, returns a jQuery object with a length of 0.

Andrew Hare
Nope that does not work, the li still has no class assigned
Murtaza RC
Sorry , it did work, I had a syntax error in my code ! Thanks that was easy - foolish to post a question :)
Murtaza RC
I just tried this. It does work. Are you running that code bit in $(document).ready()?
Stefan Kendall
why the li filter?
redsquare
@redsquare - Otherwise I would need to do this: `$(".meuble-tab").parent(),get(0).addClass("active");` - I figured my approach was more concise,
Andrew Hare