I am using this to select a tr when clicked on to change the color of a tr.
$("tr").click(function(){
$(this).addClass("selected").siblings().removeClass("selected");
});
See fiddle http://jsfiddle.net/4sn38/3/
but when I use a nth-child class on the parent div to set the tr background, my addClass isn't getting added. How can I use the nth-child class in tandem with my jquery addClass function?
this is what I'm trying to do
See fiddle http://jsfiddle.net/4sn38/
this didn't work
$(".list tr:nth-child(1)").addClass("selected").siblings().removeClass("selected");
this changes the color, but then I can't remove it when another is clicked
$(this).css('background','blue');
Any ideas what I'm doing wrong?