Answers for "how to create child element in javascript"

1

how to appendChild in the begin of the div javascript

var element = document.getElementById("div1");
element.insertBefore(para, element.firstChild);
Posted by: Guest on June-24-2020
0

child element js

//<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"></p>

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

  document.getElementById("demo").innerHTML = txt;
}
<!-- </script> -->
Posted by: Guest on August-13-2021

Code answers related to "how to create child element in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language