Element
- absolutize
- addClassName
- addMethods
- adjacent
- ancestors
- childElements
- classNames
- cleanWhitespace
- clonePosition
- cumulativeOffset
- cumulativeScrollOffset
- descendantOf
- descendants
- down
- empty
- extend
- fire
- firstDescendant
- getDimensions
- getElementsByClassName
- getElementsBySelector
- getHeight
- getOffsetParent
- getStyle
- getWidth
- hasClassName
- hide
- identify
- immediateDescendants
- insert
- inspect
- makeClipping
- makePositioned
- match
- next
- nextSiblings
- observe
- positionedOffset
- previous
- previousSiblings
- readAttribute
- recursivelyCollect
- relativize
- remove
- removeClassName
- replace
- scrollTo
- select
- setOpacity
- setStyle
- show
- siblings
- stopObserving
- toggle
- toggleClassName
- undoClipping
- undoPositioned
- up
- update
- viewportOffset
- visible
- wrap
- writeAttribute
insert
1.6
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).