jquery check if class exists on page code example
Example 1: jquery check if a class exists
if ($(".mydivclass")[0]){
} else {
}
Example 2: if a class exists jquery
if ($(".mydivclass").length){
} else {
}
Example 3: jquery check if element has class starting with
if(!$(this).is('[class*="answerbox"]')) {
} else {
}
Example 4: how to find a name of class from page in jquery
if ($(".Mandatory").length > 0) {
$(".Mandatory").each(function() {
$(this).doSomejQueryWithElement();
});
}
Example 5: how to find a name of class from page in jquery
if ($('.Mandatory').length > 0) {
}