if($('#some-div').length)){ /* exists */}

how to tell if an element exists