title: jQuery how to find an data element value
body: <p>I have this html code:</p>
  
  <pre><code>&lt;body&gt;
  ....
  &lt;span data-code="code100"&gt;...&lt;/span&gt;
  ....
  &lt;div data-code="code101"&gt;...&lt;/div&gt;
  &lt;input type="test" ... data-code="code102"&gt;...&lt;/input&gt;
  ...
  &lt;b data-code="code103"&gt;...&lt;/b&gt;
  etc...
  &lt;/body&gt;
  </code></pre>
  
  <p>Now I want to find all elements with [data-code] and get the data-code value (code100, code101, code 103, code104)</p>
  
  <p>This don't work:</p>
  
  <pre><code>var arr = $("[data-code]");
      $.each(arr, function(key) {
          alert($(key).data('data-code'));
      });
  </code></pre>
  
  <p>How can I do this?</p>