Wednesday, 11 September 2013

Find active links parent and clone nested ul

Find active links parent and clone nested ul

//This works! but I was trying to avoid the extra class
$("a.active").parent().addClass("active");
$('li.active ul').clone().appendTo('.leftnav').removeClass();
// this does not work
$("a.active").parent(function () {
$('this ul').clone().appendTo('.leftnav').removeClass();
})
// does not work either
var activeLink = $("a.active").parent();
$(activeLink('ul')).clone().appendTo('.leftnav').removeClass();



Can you add to the "this" by looking for its nest ul?
if not
what about placing it in a variable?

No comments:

Post a Comment