jquery hasclass multiple code example
Example 1: jQuery hasClass() - check for more than one class
element.is('.class1, .class2')
element.hasClass('class1') || element.hasClass('class2')
Example 2: jquery hasclass multiple classes
jQuery('button').click(function(){
var hcls =jQuery('p').hasClass('class2').addClass('class2');
if(hcls == true){
alert('Yuor class is remove ');
}
else{
alert('your class is nnot remove');
}
});
Example 3: JQuery .hasClass for multiple values in an if statement
if ($('html').is('.m320, .m768')) { ... }
Example 4: JQuery .hasClass for multiple values in an if statement
var $html = $("html");
if ($html.hasClass('m320') || $html.hasClass('m768')) {
}