How can i check if css class exists on page and add new one to the body
function mytheme_preprocess_html(&amp;$vars) {
  $vars['classes_array'][] = 'new-class';
} 


or

if ($('body.mydivclass').length &gt; 0) {
  $('body').addClass('new-class');
}