Checking if a div exists is fairly simple
if(document.getif(document.getElementById(\'if\')){ }
But how can I check if a div with the give
Try getting the element with the ID and check if the return value is null:
document.getElementById('some_nonexistent_id') === null
If you're using jQuery, you can do:
$('#some_nonexistent_id').length === 0