Reputation: 1083
I know how to addClass if it does not exist e.g.
$("ul:not([class~='bbox'])").addClass("bbox");
Or
if(!$("ul").hasClass("class-name")){
$("ul").addClass("bbox");
}
But how do I check if ul
element itself with a class already exist and if ul
doesn't exist then add one?
Upvotes: 1
Views: 80