Answers for "check if class exists JQ"

CSS
1

if a class exists jquery

if ($(".mydivclass").length){
    // Do something if class exists
} else {
    // Do something if class does not exist
}
Posted by: Guest on November-28-2020
1

jquery check if a class exists

if ($(".mydivclass")[0]){
    // Do something if class exists
} else {
    // Do something if class does not exist
}
Posted by: Guest on May-06-2020
0

jquery check if has class

if ($("#about").hasClass("opened")) {
  $("#about").animate({right: "-700px"}, 2000);
}
Posted by: Guest on November-06-2021

Code answers related to "check if class exists JQ"

Browse Popular Code Answers by Language