Prototype This page is part of the Prototype JavaScript framework documentation.
Overview | (...)

Insertion.Top takes two parameters, the content to be inserted and the id of the element to which this content will be appended.
Insertion.Top inserts text (or a HTML snipet) as a first child of element.

Syntax


  new Insertion.Top(element, content);

element can be any DOM Element object or ID.

content can be either text or HTML snipet.

Example


<p>
   <a href="#" onclick="new Insertion.Top('mylist', '<li>Yet another list item!</li>'); return false;">
      Add another list item!
   </a>
</p>

<ul id="mylist">
   <li>a list item.</li>
   <li>another list item.</li>
</ul>

creates:

Add another list item!