javascript - Function that to look up then perform task -
i trying write short script looks see if class or id present in document. if following:
$(".tab_item").removeclass("tab_item_color"); $(this).addclass("tab_item_color");
you can use length
property on jquery object. example:
if( $('.your-class').length ) { $(".tab_item").removeclass("tab_item_color"); }
the if()
block execute if there element in dom has class of your-class
.
Comments
Post a Comment