title: Finding the FORM that an element belongs to in JavaScript
body: <p>How can I find out which FORM an HTML element is contained within, using a simple/small bit of JavaScript? In the example below, if I have already got hold of the SPAN called 'message', how can I easily get to the FORM element?</p>
  
  <pre><code>&lt;form name="whatever"&gt;
      &lt;div&gt;
          &lt;span id="message"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The SPAN might be nested within other tables or DIVs, but it seems too long-winded to iterate around .parentElement and work my way up the tree. Is there a simpler and shorter way?</p>
  
  <p>If it wasn't a SPAN, but an INPUT element, would that be easier? Do they have a property which points back to the containing FORM? Google says no...</p>