var fragment = Document.createdocumentfragment (); li = document.createelement (' li '); li.classname = "xxx"; Fragment.appendchild (LI); document.getElementById ("xx"). appendchild (fragment);
As above, it is necessary to create the node first, the node content becomes a part of the document talent appendchild. Suppose that direct appendchild ("<div></div>") is not possible. Since appendchild (node) is usually joined after the last child node of the specified element node but assumes that node is a DOM object in the page, then it is not a join node, it is a direct move node. AppendChild you can understand to move an element. If you want to copy a past, clone in advance but in any case, this node needs to exist first. Append () is preceded by the object to be selected, followed by the element content to be inserted inside the object
AppendTo () is preceded by the content of the element to be inserted and is a jquery object. And back is the object to select
Instance:
A purely personal point of view. I hope you have the wrong advice, thank you
JS native Append child nodes