The ParentNode.prepend () method inserts a set of Node objects or DOMString objects before the first child of the ParentNode. DOMString objects are inserted as equivalent Text nodes
Perhaps you're asking about the DOM methods appendChild and insertBefore.. parentNode.insertBefore(newChild, refChild) Inserts the node newChild as a child of parentNode before the existing child node refChild. (Returns newChild.). If refChild is null, newChild is added at the end of the list of children. Equivalently, and more readably, use parentNode.appendChild(newChild)
The Node.appendChild() method adds a node to the end of the list of children of a specified parent node. If the given child is a reference to an existing node in the document, appendChild() moves it from its current position to the new position (there is no requirement to remove the node from its parent node before appending it to some other node)
The .prepend() and .prependTo() methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With .prepend(), the selector expression preceding the method is the container into which the content is inserted.With .prependTo(), on the other hand, the content precedes the method, either as a selector expression or as markup created.
Using the property innerHTML of an element to get or modify its content:. var el = document.querySelector('div'); // get element content as string console.log(el.innerHTML) // append to the element's conten
PrependChild<T>(T) Inserts the specified element at the beginning of the current element's list of child nodes. (Inherited from OpenXmlCompositeElement.) PrependChild<T>(T) Inserts the specified element at the beginning of the current element's list of child elements. (Inherited from OpenXmlElement.
Output. Click me to prepend. This is the jQuery Tutorial. The above example contains the content with three tags span, strong and b.When you click the click me button, the jQuery prepend function add the content at the start of the HTML element with the output of these tags
How can I implement prepend and append with regular
Node.appendChild() - Web APIs MD
jQuery prepend() Method - W3School