Sign in


Create new elements and insert them before the selected elements, or move elements from another location into position before the selected elements.




Describes the elements or nodes to place into the document. This may be a string, Object, Array, or DOM node, whose syntax is described under .build().

Return value

This method is chainable.

This method returns a Neon object containing all of the inserted elements, replacing the previous selection. In case the inserted elements had children, the returned object will contain the top level elements, and their children can be accessed by accessing their respective childNodes attributes.


This method allows you to create new DOM elements and other nodes, and insert them into the document before the selected elements.

This method also allows you to move nodes from one part of the document to another. If the element (or elements) supplied in the specification argument is already part of the document, it will be moved to its new location.

When moving from a single destination to multiple destinations, the element will be moved to the first destination, then cloned multiple times so that copies are inserted at the other destinations too.

specification syntax

Please see .build() for the syntax required to build new nodes.


The following simple example inserts a single span of text before an element called "nextbutton":"#nextbutton").insert({span: "Next: "});

The following complex example shows many nodes being created at once.

menuspec = {ul: [
{li: {a: "Yahoo", $href: ""}},
{li: {a: "Google", $href: ""}}
], $class: "menu"};"#copyrightnotice").insert(menuspec);

The following example demonstrates how .insert() can be used to move a node from one location to another:"#complete").insert("#inprogress"));