daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function appendChildren(decorateDivFunction) {
  2.   var allDivs = document.getElementsByTagName("div");
  3.   var lengthData = allDivs.length;//menambahkan sebuah variabel
  4.   for (var i = 0; i < lengthData; i++) {
  5.     var newDiv = document.createElement("div");
  6.     decorateDivFunction(newDiv);
  7.     allDivs[i].appendChild(newDiv);
  8.   }
  9. }
  10.  
  11. // Example case.
  12. document.body.innerHTML = `
  13. <div id="a">
  14.   <div id="b">
  15.   </div>
  16. </div>`;
  17. appendChildren(function(div) {});//menghapus bagian dari garis miring2
  18. console.log(document.body.innerHTML);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top