JQuery Add Class to Specific Div
I Have a Piece of Code That Is Reading How Many Items Are in a Shopping Basket, I Would Like to Add a Class to a Div with the Id of #Basket_Count. I Know How...
I have a piece of code that is reading how many items are in a shopping basket, I would like to add a class to a div with the id of #basket_count. I know how to add a class to the span tag were the counter is appearing. Not sure how to go from here, any help would be appreciated.
$('span#ctl00_lblItems').filter(function (index) {
return parseInt(this.innerHTML) > 0;
}).addClass("green");
1 Answer
same way as you added class to your span
$("#basket_count").addClass("your_class");