html - Check if a div does NOT exist with javascript -


checking if div exists simple

if(document.getif(document.getelementbyid('if')){  } 

but how can check if div given id not exist?

var myelem = document.getelementbyid('myelementid'); if (myelem === null) alert('does not exist!'); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -