title: Javascript innerhtml of checkbox
body: <p>Well I have some checkboxes with id='0','1','2','3' etc. So I need to get text of checkboxes. Here is code of checkboxes in PHP.</p>
  
  <pre><code>'&lt;input id="'.$i.'"type="checkbox" name="option1" value="a1" onclick="checkYears()"&gt;'.$years[$i].'&lt;/input&gt;
  </code></pre>
  
  <p>So i need to get $years[$i]-value.
  I'm using this code.</p>
  
  <pre><code>while (bool==false)
      {
          if (document.getElementById(i)!=null)
          {
              if (document.getElementById(i).checked)
              {
                  years.push(1);
                  yearsValue.push(document.getElementById(i).innerHTML);
                  document.getElementById(i).innerText="WORKS";
                  console.log(yearsValue[i]);
              }
              else
              {
                  years.push(0);
                  yearsValue.push(document.getElementById(i)).innerHTML);
                  console.log(yearsValue[i]);
              }
          }
          else 
          {
              bool=true;
          }
          i++;
      }
  </code></pre>
  
  <p>0's and 1's are added ok, but when i'm trying to use innerHTML there is and undefined values in consle.</p>
  
  <p>Any suggestions?</p>