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

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -