title: jQuery each loop of all data attributes
body: <p>I'm trying to reset data attributes after an animation and am running through some trouble applying the technique from <a href="https://stackoverflow.com/questions/8459448/how-to-get-data-key-name-from-data-attribute">answer 2 of this post</a>.</p>
  
  <p>Not sure what I'm missing here. Seems theoretically feasible to say for <code>each</code> <code>data</code> attribute, etc.</p>
  
  <hr>
  
  <p>UPDATE:</p>
  
  <p>Worth mentioning that the <code>data</code> keys are all different. E.g. <code>data-1="abc"</code>, <code>data-2="abc"</code>, etc, hence the need for a <code>for</code> loop that simply looks for <code>data</code> attributes.</p>
  
  <p>HTML</p>
  
  <pre><code>var total = 0;    
  $.each($('*').data(), function(key, value) {        
      if (key){    
          var thiis = $(this);            
          total += key;            
          thiis.removeData();            
          thiis.data(total, value);
      }
  });
  </code></pre>