A Pen by Sean Corbett

Thumbnail
This awesome code was written by Corpheus91, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright Corpheus91 ©
  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Sean Corbett</title>
  
  
  
  
  
</head>

<body>

  <div id="a"></div>
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/Corpheus91/a-pen-by-sean-corbett-ZvxwEQ */
function appendChildren() {
  var allDivs = document.getElementsByTagName("div");
  
  var length = allDivs.length;

  for (var i = 0; i < allDivs.length; i++) {
    var newDiv = document.createElement("div");
    decorateDiv(newDiv);
    newDiv.innerHTML = "JSAKL"
    allDivs[i].appendChild(newDiv);
  }
}

// Mock of decorateDiv function for testing purposes
function decorateDiv(div) {}

appendChildren()

Comments