1//jQuery get class name of element 
2var className=$('#myElementID').attr('class');
31if ($(".Mandatory").length > 0) {
2    // Do stuff with $(".Mandatory")
3    $(".Mandatory").each(function() {
4        // "this" points to current item in looping through all elements with
5        // class="Mandatory"
6        $(this).doSomejQueryWithElement();
7    }); 
8}
91$("input[type='submit']").click(function() {
2    if ($(".Mandatory").length > 0) {
3        // Do some code here
4    }
5});
6