title: Function redirect if Div Id on my page won't work
body: <p>I need to redirect page if div id found inside the page.</p>
  
  <p>I have this script :</p>
  
  <pre><code> &lt;script&gt;
  
   if (!document.getElementById("locationsHolder")) {
   window.location.href = "logged.html";
   }
   &lt;/script&gt;
  </code></pre>
  
  <p>On the same page I have this</p>
  
  <pre><code> &lt;div class="locationsHolder" id="locationsHolder"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Although I have everything right it loads logged.html page whatever id I put on getElementById.  i.e. getElementById("notexist")</p>