title: Why is my Javascript not work in jsp page?
body: <p>I create function to make the first radion button is checked but my javascript is not working. When i use it in jsfiddle it work perfect but when i try in jsp page, it not working any more. Can anyone tell me what am i do wrong? I work with struts 1, and don't use any jquery libs.</p>
  
  <p>This is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>document.querySelectorAll('[name=radioButton]')[0].checked = true;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;table id="tabledata" style="width: 80%" border=1&gt;
     &lt;tr&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;Name&lt;/th&gt;
      &lt;th&gt;Code&lt;/th&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td&gt;&lt;input type="radio" name="radioButton"&gt;&lt;/td&gt;
      &lt;td&gt;122222222222222&lt;/td&gt;
      &lt;td&gt;4444444444444444 &lt;/td&gt;
     &lt;/tr&gt;
             &lt;tr&gt;
      &lt;td&gt;&lt;input type="radio" name="radioButton"&gt;&lt;/td&gt;
      &lt;td&gt;122222222222222&lt;/td&gt;
      &lt;td&gt;4444444444444444 &lt;/td&gt;
     &lt;/tr&gt;
              &lt;tr&gt;
      &lt;td&gt;&lt;input type="radio" name="radioButton"&gt;&lt;/td&gt;
      &lt;td&gt;122222222222222&lt;/td&gt;
      &lt;td&gt;4444444444444444 &lt;/td&gt;
     &lt;/tr&gt;
              &lt;tr&gt;
      &lt;td&gt;&lt;input type="radio" name="radioButton"&gt;&lt;/td&gt;
      &lt;td&gt;122222222222222&lt;/td&gt;
      &lt;td&gt;4444444444444444 &lt;/td&gt;
     &lt;/tr&gt;
     &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And this is my jsp code:</p>
  
  <pre><code>&lt;html:form action="/Showdata"&gt;
      &lt;div class="loaddata"&gt;
      &lt;table id="tabledata" style="width: 80%" border=1&gt;
              &lt;tr&gt;
                  &lt;th&gt;&lt;/th&gt;
                  &lt;th&gt;Name&lt;/th&gt;
                  &lt;th&gt;Code&lt;/th&gt;
              &lt;/tr&gt;
              &lt;logic:iterate id="listEmp" name="ShowdataForm" property="listEmp"&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;input type="radio" name="radioButton"&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;bean:write name="listEmp" property="name"/&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;bean:write name="listEmp" property="code"/&gt; &lt;/td&gt;
              &lt;/tr&gt;
              &lt;/logic:iterate&gt;
              &lt;/table&gt;
      &lt;/div&gt;
  &lt;/html:form&gt;
  </code></pre>