jquery find by attr and change parent -
i want change class of parent element found find method of jquery:
$("#navi").find("a[href='" + ultiparent + "']").addclass("active"); works, result <a class="active" href="blub">
$("#navi").find("a[href='" + ultiparent + "']").parent().addclass("active"); does not work!
i need <li class="active"><a href="blub">
thank you!
i think want this
onclick of link href , add class parent li
js
$("ul li a").click(function(e) {     event.preventdefault();      var = $(this).attr("href")     $("ul li").removeclass("active")     $(this).parents("li").addclass("active")     alert(a) }); 
Comments
Post a Comment