insert(element, { position: content }) -> HTMLElement
insert(element, content) -> HTMLElement

Inserts content before, after, at the top of, or at the bottom of element, as specified by the position property of the second argument. If the second argument is the content itself, insert will append it to element.

insert accepts the following kind of content: text, HTML, DOM element, and any kind of object with a toHTML or toElement method.

Note that if the inserted HTML contains any <script> tag, these will be automatically evaluated after the insertion (insert internally calls String#evalScripts when inserting HTML).