无法在'Node'上执行'appendChild':参数1的类型不是'Node

问题描述 投票:0回答:1

我正在尝试以最简单的方式向现有内容中添加新文本,在我的情况下,我只能修改段落元素中的脚本,但是我收到此错误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 jquery html ecmascript-6 ecmascript-5
1个回答
1
投票
© www.soinside.com 2019 - 2024. All rights reserved.