Home  >  Article  >  Web Front-end  >  Solution to JavaScript error when adding elements using append_javascript skills

Solution to JavaScript error when adding elements using append_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:42:501971browse

1. Error description

On IE browser:

Uncaught HierarchyRequestError:Failed to excute 'appendChild' on 'Node':The new child element contains the parent.

On Google Chrome:

SCRIPT5022:DOM Exception:HIERARCHY_REQUEST_ERR(3) error

2. Error reason

Include append() within append()

For example:

append(append("String"));

3. Solution

Remove the append in append and put the string in the inner append into the outer append

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn