title: I get an undefined error in my error console
body: <p>My myclickHandler function works perfectly but when I go on to my error console I get this error:</p>
  
  <blockquote>
    <p>document.getElementsByName("prequestion")[0] is undefined;</p>
  </blockquote>
  
  <p>Below is my code </p>
  
  <pre><code>&lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;
          &lt;title&gt;Create a Session&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  
      document.getElementsByName("prequestion")[0].addEventListener('click', myClickHandler);
  
      function myClickHandler(){
           if(validation()){
              openSessionPopup();
           }
  
    &lt;/script&gt;
      &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;form action="create_session.php" method="post" name="sessionform"&gt;
  
  &lt;p&gt;&lt;strong&gt;10: &lt;/strong&gt;&lt;input class="questionBtn" type="button" value="Prepare Questions" name="prequestion" onClick="myClickHandler()"/&gt;&lt;/p&gt;   
  
  &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>My question is what do I need to remove this error? because my function works does it matter if it shows an error in the error console?</p>