JSFiddle - React, Tailwind, and code Playground
by elpakks
HTML
<div id="aWrapper">
<input value="John"/>
<input value="Pete"/>
<input value="Serge"/>
</div>
JavaScript
function doStuff()
{
var item1 = document.getElementById("aWrapper");
item1.style.backgroundColor = "red";
var children = item1.childNodes;
for (var i=0; i< children.length; i++)
{
if (children[i].tagName == "input" && children.value[i] == "Pete")
{
children[i].value = "Kafka";
children[i].style.backgroundColor = "red";
}
}
}
//if a child has tagName input and value Pete change the value to Kafka and set this tag's background to red
// {
// console.log(children[i]);
//}
window.onload=doStuff;