JSFiddle - React, Tailwind, and code Playground

by Adil Heybətov

HTML

<p>Click the button to get the tag names of the body element's children.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo">
  <ul>
    <li>adsasd</li>
  </ul>
</p>

<script>
function myFunction() {
    var c = document.getELementById('demo').children;
    var txt = "";
    var i;
    for (i = 0; i < c.length; i++) {
        txt = txt + c[i].tagName + "<br>";
    }

    document.getElementById("demo").innerHTML = txt;
}
</script>