Why am i getting " Uncaught TypeError: Cannot read property 'addEventListener' of undefined"
<p>I can't figure out why i am getting this error: "Uncaught TypeError: Cannot read property 'addEventListener' of undefined " </p>

<p>Here is the code:</p>

<p>HTMl</p>

<pre><code>&lt;form method="post" action="" id="security-check"&gt;
&lt;input type="text" name ="first" placeholder="First Name"&gt;
&lt;input type="text" name ="last" placeholder="Last Name"&gt;
&lt;input type="number" name ="dob" placeholder="DOB"&gt;
&lt;input type="text" name ="state" placeholder="State"&gt;
&lt;input type="submit" value="submit"&gt;
&lt;/form&gt;
</code></pre>

<p>JavaScript </p>

<pre><code>var input = document.getElementsByTagName('input');
var fname = input[0];
var lname = input[1];
var dob = input[2];
var rez = input[3];

function idCheck(first, last, date, state){
  this.first    = "Teddy";
  this.last     = "Broosevelt";
  this.date     = 03041894;
  this.state    = "NY";

  if(firstName != this.first){return false;};
  if(lastName != this.last ){return false;};
  if(birthDate != this.date){return false;};
  if(rez != this.state){return false;};
}

input[4].addEventListener('submit', function(e){

  idCheck(fname, lname, dob, rez);
  e.preventDefault();

}, false);
</code></pre>