JSFiddle - React, Tailwind, and code Playground

by brianarn

HTML

<div id="foo" data-mything="bar" href="blah">Output</div>
<ul id="output"></ul>

JavaScript

var foo = document.getElementById('foo'), output = document.getElementById('output'), li = document.createElement('li'), attribute;

for (var i = 0, l = foo.attributes.length; i < l; i++){
    attribute = foo.attributes[i];
    li.innerHTML = 'Attribute: ' + attribute.name + ' - Value: ' + attribute.value;
    output.appendChild(li.cloneNode(true));
}