//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();
您可以通过查找它的巢 ul 来添加到“this”吗?
如果不
把它放在一个变量中怎么样?