Reputation: 237
Can you please take a look at This Demo and let me know why I am not able to add .sale
class to last columns of table which has a class of .item
using .find()
$(function () {
$('td:nth-child(6) ,td:nth-child(7)').find("item").addClass("sale");
});
Upvotes: 0
Views: 21
Reputation: 6933
You are missing a dot in item. It should be
$(function () {
$('td:nth-child(6) ,td:nth-child(7)').find(".item").addClass("sale");
});
http://jsfiddle.net/poz1f1a3/2/
The css
.item {
background-color: grey;
height:45px;
width:65px;
}
.sale {
background-color: yellow;
}
Upvotes: 4