[HTML 5] Inserting DOM element

2021-04-03 08:28

阅读:639

标签:app   const   after   inner   node   append   script   tno   span   

const app = document.getElementById(app);
app.innerHTML = `
  

JavaScript DOM

`; const div = document.createElement(div); const span = document.createElement(span); const p = document.createElement(p); const i = document.createElement(i); const b = document.createElement(b); div.append(span); div.prepend(p); // p.before(i); p.after(i); // Before: old way using insertBefore // i.parentNode.insertBefore(b, i); // After: old way using insertBefore + nextSibling i.parentNode.insertBefore(b, i.nextSibling); console.log(div);

 

[HTML 5] Inserting DOM element

标签:app   const   after   inner   node   append   script   tno   span   

原文地址:https://www.cnblogs.com/Answer1215/p/12541990.html


评论


亲,登录后才可以留言!