3.4. Manipulating Documents
Prototype provides utilities for manipulating documents via the Insertion objects.
Insertion.Before | Inserts content before an element |
Insertion.After | Inserts content after an element |
Insertion.Top | Inserts content at the top of an element |
Insertion.Bottom | Inserts content at the bottom of an element |
These are called via:
new Insertion.function('id',content);
For example, the code:
<span id='result'>The result is:</span> <a href="javascript:void (new Insertion.Bottom('result','100'))">click for result</a>
results in the text The result is:100 being displayed.
Get Prototype and Scriptaculous: Taking the Pain out of JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.