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

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

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

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -