title: HTMLInputElement has no method 'parent'
body: <p>I have 2 forms on my page which are very similar.</p>
  
  <p>I'm doing simple validation in jquery to check that each field has a value before using ajax to send the data on to the php handler that uses the data.</p>
  
  <p>Because of the similarities between the forms, I'm not able to know which form was submitted, so I thought I'd try differentiating by an id on the form container div</p>
  
  <pre><code>&lt;div name="contactform2" class="form"&gt;
      &lt;div width="100%" class="con2"&gt;
  
          &lt;div class="lable"&gt;
              &lt;label for="first_name"&gt;First Name *&lt;/label&gt;
          &lt;/div&gt;
          &lt;input  type="text" name="first_name" class="span4"&gt;
  
          &lt;div class="lable"&gt;
              &lt;label for="email"&gt;Email Address *&lt;/label&gt;
          &lt;/div&gt;
          &lt;input  type="text" name="email" class="span4"&gt;
  
          &lt;div class="lable"&gt;
              &lt;label for="telephone"&gt;Contact Number *&lt;/label&gt;
          &lt;/div&gt;
          &lt;input  type="text" name="telephone" class="span4"&gt;
  
          &lt;div class="lable"&gt;
              &lt;label for="comments"&gt;Message *&lt;/label&gt;
          &lt;/div&gt;
          &lt;textarea  name="comments" rows="8" class="span4"&gt;&lt;/textarea&gt;
  
          &lt;input type="submit" value="Submit" class="btn btn-success"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The only difference between the forms, really, is that one has a <code>&lt;select&gt;</code> in it and the other doesn't.</p>
  
  <p>My jquery looks like this:</p>
  
  <pre><code>$('input[type=submit]').click(function() {
      var parentname = this.parent('div').attr('name');
      console.log('Form used: ' + parentname);
  
      var fname = 0,
          email = 0,
          tel = 0;
          comm = 0;
  
      // Validate data
  });
  </code></pre>
  
  <p>I think maybe I got my selector wrong here as I normally select by id/class/tagname so I'm not even sure it's valid.</p>
  
  <p>Can anyone suggest an alternative?</p>