Below is how you will able to know if a dom element exists 🙂 Quite simple!

if($("#dom").length > 0){
  //dom exists
}else{
  //dom doesn't exists
}