Answers for "jQuery hasClass() - check for more than one class"

0

jQuery hasClass() - check for more than one class

element.is('.class1, .class2')
// works, but it's 35% slower than

element.hasClass('class1') || element.hasClass('class2')

//https://stackoverflow.com/questions/2214952/jquery-hasclass-check-for-more-than-one-class
Posted by: Guest on November-26-2020
0

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');
      }

    });
Posted by: Guest on July-08-2020

Code answers related to "jQuery hasClass() - check for more than one class"

Code answers related to "Javascript"

Browse Popular Code Answers by Language