Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery if class exists

// given an element: <div id="myID" class="wrapper active"> 
//JQuery answer
	if ( $("#myID").hasClass("active") ){
      	//true: myID has class active
      } else {
      	//false: myID does not have class active
      }
 
PREVIOUS NEXT
Tagged: #jquery #class #exists
ADD COMMENT
Topic
Name
9+7 =