jquery hasclass
snippet in javascript

jquery hasclass

user2664

if ($( "#foo" ).hasClass('className')) {
	$( "#foo" ).removeClass( 'className');
} else {
  $( "#foo" ).addClass( 'className');
}

jquery check if element has class starting with

user7209

/* Answer to: "jquery check if element has class starting with" */

if(!$(this).is('[class*="answerbox"]')) {
    //Finds element with no answerbox class
} else {
    //The element has already an answerbox class
}

jquery hasclass

user3194

$( "#mydiv" ).hasClass( "foo" )

detect if an element has a class jQurey

user8822

$("#EL_ID").hasClass("CLASS_NAME");

jquery hasclass

user6370

jQuery(Selector).hasClass('class_name');