Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery remove and add class

$( "#foo" ).toggleClass( 'className', addOrRemoveOptional );

//OR
if ($( "#foo" ).hasClass('className')) {
	$( "#foo" ).removeClass( 'className');
} else {
  $( "#foo" ).addClass( 'className');
}
 
PREVIOUS NEXT
Tagged: #jquery #remove #add #class
ADD COMMENT
Topic
Name
4+1 =