title: What is the javascript equivalent to jquery closest()?
body: <p>I have the following code, which is written in DOM API instead of jquery. I'm not sure why. It's inside the submit function for jquery form validation. I need to change the "parentNode" part so that instead of "parent" it is "closest." I'm no good with javascript. I tried my hand at converting this to jquery, but wasn't able to get that to work. Basically, if this were jquery, I'd need to change .parent() to .closest().</p>
  
  <pre><code>var summary = "";
  
  $.each(element, function() { 
  summary += "&lt;li&gt;" + this.element.parentNode.getElementsByTagName('label')[0].innerHTML.replace("\&lt;span\&gt;*\&lt;\/span\&gt;","") + "&lt;/li&gt;"; 
  });
  
  summary = summary.replace(/\&lt;li\&gt;.+\&lt;\/li\&gt;\1/, "$1");
  
  alert(summary);
  </code></pre>
  
  <p>Is this possible to do with javascript? Or, is there an easy way to convert this to jquery?</p>
  
  <p><strong>UPDATE:</strong> Here is a fiddle to help explain what I'm trying to accomplish. Basically, because I added a 'span' tag around one of the inputs, the 'p' tag is no longer the parent. As such, the parentNode is not finding the 'p' tag anymore.</p>
  
  <p><strong><a href="http://jsfiddle.net/9um8xt79/1/" rel="nofollow">http://jsfiddle.net/9um8xt79/1/</a></strong></p>
  
  <p>UPDATE 2 -- THE previous fiddle link was incorrect. The link above is the right one.</p>
  
  <p>How can I modify to find the <code>&lt;p&gt;</code> tag regardless of whether it is the direct parent, or a grandparent?</p>