title: Looping through element's data- attributes
body: <p>Per,</p>
  
  <p><a href="https://stackoverflow.com/questions/828311/how-to-iterate-through-all-attributes-in-an-html-element">How to iterate through all attributes in an HTML element?</a></p>
  
  <p>you get the general solution:</p>
  
  <pre><code>for (var i = 0; i &lt; elem.attributes.length; i++) {
    var attrib = elem.attributes[i];
    if (attrib.specified) {
      alert(attrib.name + " = " + attrib.value);
    }
  }
  </code></pre>
  
  <p>How would I make this general solution more specific to only alert the values of the data- attribute.</p>
  
  <p>Would I need to regex attrib.name or is there a simpler way?
  Here is some sample HTML with 2 data- attributes:</p>
  
  <pre><code>&lt;div id='universals' data-path='/zz/' data-load='1'&gt;&lt;/div&gt;
  </code></pre>