class add in jquery code example
Example 1: jquery addclass
$("#elem").addClass("classname");
Example 2: jquery add class
if ($( "#foo" ).hasClass('className')) {
$( "#foo" ).removeClass( 'className');
} else {
$( "#foo" ).addClass( 'className');
}
Example 3: addclass jquery
$( "p" ).addClass( "myClass yourClass" );
Example 4: javascript add class to element
var someElement= document.getElementById("myElement");
someElement.className += " newclass";//add "newclass" to element (space in front is important)