title: jQuery data attribute selector for closest parent
body: <p>My code have data attribute set for many elements (Not For All Elements) in below manner.</p>
  
  <ol>
  <li><code>&lt;div id='dvStorage' data-testing='storage_div'&gt;</code></li>
  </ol>
  
  <p>And, for some of the elements (Not For All Elements) data attribute is set with below approach.</p>
  
  <ol start="2">
  <li><code>$("#ElementID").data("testing", "data value");</code></li>
  </ol>
  
  <p>Now, the problem comes. When any button on the document is clicked, I need to find its parent having data attribute (testing) is set. As mentioned, all elements do not have data attribute, so I need to travese upwards in the hierarchy until the expected element is found.</p>
  
  <p>For #1 approach, <code>$("#buttonID").closest("[data-testing]")</code> works. But not for #2 approach.</p>
  
  <p>For #2 approach, I need to iterate through button <code>parents()</code> and verify if it has <code>.data("testing")</code> or not. I need to avoid this iteration. And have one common approach that works for #1 and #2.</p>
  
  <p>Here, it is not required to verify value of data-testing, but to get the first parent in hierarchy having "testing" set as its data attribute.</p>
  
  <p>Thanks in advance.</p>
  
  <p><a href="https://jsfiddle.net/murarid/L8d3kk2e/2/" rel="noreferrer">JSFIDDLE Demo</a></p>