JSFiddle - React, Tailwind, and code Playground
HTML
<BODY onload="foo()">
<div class="item" ></div>
<div class="item one" ></div>
</BODY>
JavaScript
function foo()
{
e = document.getElementsByClassName('item');
for(var i = 0; i < e.length; i++) {
if(e[i].className == 'item') {
// Do something with the element e[i]
alert(e[i].className);
}
}
}