title: Element type "myelement" must be followed by either attribute specifications, ">" or "/>
body: <p>My script function is defined inside a JSF2 form on a XHTML page and the following part of the code causes a problem:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    function myFunction(){
     var checkboxes = document.getElementsByName('mycheckboxes');
     if(checkboxes.length &gt; 0){
       for (var i=0; i&lt;checkboxes.length; i++){
        var checkbox = checkboxes[i];
       }
      }
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>When trying to access the page in FireFox 8 it prints the exception:</p>
  
  <blockquote>
    <p>Element type "checkboxes.length" must be followed by either attribute specifications, ">" or "/>"</p>
  </blockquote>
  
  <p>what does this error mean?</p>
  
  <p>Another question: is the script is executed before the pages is rendered? Because my checkboxes is loaded in the page during render phase of page (using JSF <code>&lt;ui:repeat&gt;</code>), so my guess is that I must make a condition to execute the code when the variable checkboxes is not null, am I right?</p>