# NotFoundError: Node.removeChild: The node to be removed is not a child of this node

**URL:** <https://meta.discourse.org/t/notfounderror-node-removechild-the-node-to-be-removed-is-not-a-child-of-this-node/154739>\
**Category:** Development\
**Created:** [June 13, 2020, 9:50am UTC](https://meta.discourse.org/t/notfounderror-node-removechild-the-node-to-be-removed-is-not-a-child-of-this-node/154739 "2020-06-13T09:50:02Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![magjac](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/magjac/32/174488_2.png) [@magjac](https://meta.discourse.org/u/magjac)\
**Post date:** [June 13, 2020, 1:47pm UTC](https://meta.discourse.org/t/notfounderror-node-removechild-the-node-to-be-removed-is-not-a-child-of-this-node/154739/3 "2020-06-13T13:47:23Z")

</div>

I can reproduce this with this simple theme component:

```plaintext
<script type="text/discourse-plugin" version="0.8">

  api.decorateCooked($elem => {
    if ($elem.get(0).className == 'd-editor-preview') {
      const $paragraphs = $elem.children('p');
      $.each($paragraphs, (paragraphIndex, paragraph) => {
        paragraph.remove();
      });
    }
  });

</script>

```

1. Create a new topic
2. Start typing. The error appears in the dev console for the second character that is typed.

---

_[View the full topic](https://meta.discourse.org/t/notfounderror-node-removechild-the-node-to-be-removed-is-not-a-child-of-this-node/154739)._
