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 -

javascript - Preserving URL fragment through CAS sign-on -

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