check id has class or not jquery code example
Example 1: has not class jquery
if (!$(this).hasClass("test")) {
Example 2: if element has class jquery
if ($(".mydivclass")[0]){
// Do something if class exists
} else {
// Do something if class does not exist
}