I'm trying to find a child with this exact background color in a nav_list ul.
All <li>
items are created dynamically; the alert()
gives me undefined
, what am I doing wrong?
var matching = $('.nav_list li').filter(function(){
return $(this).attr('background-color') == "rgb(72, 76, 111)"
});
alert(matching.attr("class"));
答案 0 :(得分:0)
我最终使用.addClass("selected")
来标记用户点击的<li>