title: Uncaught TypeError: Cannot read property 'checked' of null
body: <p>I have JavaScript error <code>Uncaught TypeError: Cannot read property 'checked' of null.</code></p>
  
  <p>I want to redirect to another page if checked at least one check box. What is it I missed?</p>
  
  <pre><code>function check(){
  
   for(var i = 0;i &lt; 3;i++){
      var x = document.getElementById("c" + String(i)).checked;
  
      if (x == true){
          alert('select');
          window.location = "#";
      }
      else {
          alert('not select');
      }
    }
  }
  </code></pre>