// check if element exists
if($('selector').length){
 //do something 
}


// check if element does not exist
if(!$('selector').length){
 //do something
}