1if ($(".mydivclass")[0]){
2 // Do something if class exists
3} else {
4 // Do something if class does not exist
5}
1/* Answer to: "jquery check if element has class starting with" */
2
3if(!$(this).is('[class*="answerbox"]')) {
4 //Finds element with no answerbox class
5} else {
6 //The element has already an answerbox class
7}