title: JavaScript compare Element.style.display
body: <p>I have a page with a lot of  elements on it like below: </p>
  
  <pre><code>&lt;tr class="blah" style="Display:none;"&gt;
  </code></pre>
  
  <p>When I encounter an element like the one above, I want to do some processing on it. The problem I am running into is that the "if clause" never returns a true value. The alert will display a "none" (without the quotes). I expect the "if clause" to evaluate to true. I have tried using "==" and adding a ".ToString()" after the display. This does not work. </p>
  
  <pre><code>var rows = document.getElementsByTagName("tr");
  for(var i=0; i &lt; rows.length; i++) { 
      alert(rows[i].style.display);
      if (rows[i].style.display === "none") { 
          //Do some stuff 
          //Code never gets here. 
      }
  }
  </code></pre>
  
  <p>Why does the comparison in the "if clause" always evaluate to false? </p>