david david - 1 month ago 4x
jQuery Question

Function that to look up then perform task

I am trying to write a short script that looks to see if a class or id is present in then document. If it is then do the following:



You can also do this

First Way

$(function() { 
    if ($('.yourClassName').length){
        $(".tab_item").removeClass("tab_item_color").addClass("YourNewClassName"); //It will swap your class.                          

For more information you can also visit .length