var op=document.querySelector('p');
var oP=document.createElement('p');
console.log(oP);
oP.innerHTML='hello';
op.append(oP);
这里为什么输出不是<p></p>,而是<p>hello</p>呢?
Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这是把你的节点输出,节点中不是包括内容的嘛
这是浏览器节省运算资源的行为,如果调试的时候没有打开控制台,console.log它打印的是已经处理完的对象,如果你开着控制台看输出,console.log打印出的就是实时的对象。