title: Uncaught TypeError: Cannot read property 'innerHTML' of null when unchecking checkbox
body: <p>There is a function <code>hideLabels</code> that should save the current value of selected label and then return it when the checkbox is unchecked back (after it has been checked once). The console says: <code>"Uncaught TypeError: Cannot read property 'innerHTML' of null "</code> but i still can't see where the error is.</p>
  
  <pre><code>&lt;script&gt;
  
   function hideLabels(labelname) {
  
      var labelInitial=document.getElementById(labelname).innerHTML ;
      if (document.f.test.checked==true) {
          document.getElementById(labelname).innerHTML="";
      } else {
          document.getElementById(labelname).innerHTML=labelInitial;
      } };
  
  function hideComments() {
  
      hideLabels(label_1) ;
      if (document.f.test.checked==true) {
          document.f.s.style.display="none";
      } else {
          document.f.s.style.display="inline";
      } };
  
  &lt;/script&gt;
  
  &lt;FORM name=f &gt;
  
  &lt;label ID="label_1" for="s"&gt;Select please!&lt;/label&gt;
  
  &lt;SELECT NAME=s&gt;
      &lt;OPTION&gt;First Option&lt;/OPTION&gt;
      &lt;OPTION&gt;Second Option&lt;/OPTION&gt;
      &lt;OPTION&gt;Third Option&lt;/OPTION&gt;
  &lt;/SELECT&gt;
  &lt;BR&gt;
  
  &lt;INPUT name="test" TYPE=checkbox VALUE="test" onChange="hideComments()";&gt;
  &lt;INPUT type=button value="Alert" onClick="alert(document.getElementById('label_1').innerHTML)";&gt;
  
  &lt;/FORM&gt;
  </code></pre>