how to find all the class demo in body in jauery code example
Example 1: get all classes of element jquery
var classList = $('#divId').attr('class').split(/\s+/);
$.each(classList, function(index, item) {
if (item === 'someClass') {
//do something
}
});
Example 2: how to find a name of class from page in jquery
if ($(".Mandatory").length > 0) {
// Do stuff with $(".Mandatory")
$(".Mandatory").each(function() {
// "this" points to current item in looping through all elements with
// class="Mandatory"
$(this).doSomejQueryWithElement();
});
}