I try to find all elements whith a particular attribute. For each elements, I want to do something dependant of the value of the attribute.
I did a test to take back the value of the attribute but it doesn't work and I don't see the problem.
HTML:
<div id="t">Test</div>
<div data-test="One">Value One</div>
<div data-test="Two">Value Two</div>
JS:
$("[data-test]").each(function(){
$("#t").append(this.attr("data-test"));
});
JsFiddle link: http://jsfiddle.net/fbue5dpc/
Thank you!