【发布时间】:2020-04-01 12:10:38
【问题描述】:
我试图以最简单的方式将新文本添加到现有文本中,在我的情况下,我只能修改段落元素内的脚本,但我收到此错误 Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node。如何以尽可能短的代码使其工作?
<!-- Many elements above this -->
<p>
This a part of the text
<script>
document.currentScript.parentNode.appendChild(" and this is the new text added");
</script>
</p>
<!-- Many elements under this -->
【问题讨论】:
标签: javascript html