📜  未捕获的类型错误:无法在“元素”上执行“插入相邻元素”:参数 2 不是“元素”类型 - Html 代码示例

📅  最后修改于: 2022-03-11 14:53:23.675000             🧑  作者: Mango

代码示例1
The second parameter of insertAdjacentElement() should be a html object.
The trick below works :)


var htmlString = `
${obj.descripiton}
${obj.value}
` var htmlObject = document.createElement('div'); htmlObject.innerHTML=htmlString; document.querySelector(".income__list").insertAdjacentElement('beforeend', htmlObject);