标签:app const after inner node append script tno span
const app = document.getElementById(‘app‘); app.innerHTML = ` <h1>JavaScript DOM</h1> `; 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