I would like to add a class (class=\"bbox\") to a ul-list but only if no class exists. This is what i have so far. How do I check with jquery if a class exists in the ul-tag
If you want to check if a specific class exists then:
if(!$("ul").hasClass("class-name")){ $("ul").addClass("bbox"); }
If you want to check if any class exists:
if ($('ul').attr('class') == '') { $("ul").addClass("bbox"); }