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-classjQuery('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');
}
});
Also in JavaScript:
- merge sort
- build angular project
- javascript remove last character of string
- html to pdf javascript
- npm image to LM hash
- Property 'src' does not exist on type 'HTMLElement' angular
- pass argument to event listener javascript
- react native elevation
- javascript loop through array backwords
- vuejs pass all events to child
- how to put react compnent to bottom
- use two div id in jquery
- javascript if equal infinity
- js show span for 5 seconds
- how to add element in json object
- javascript null check
- reverse an array javascript
- package json scripts multiple commands
- javascript onclick
- phaser game height
- how to delete element at a particular index of array in react js
- react Refused to execute inline script because it violates the following Content Security Policy directive
- remove punctuation marks from string js
- debug.xcconfig: unable to open file react native