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) }); 

http://jsfiddle.net/victor_007/5umm5aee/


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -