HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

add

Description

The add of HTMLOptionsCollection for JS inserts element before the node given by before.

The before argument can be a number, in which case element is inserted before the item with that number, or an element from collection, in which case element is inserted before that element.

If before is omitted, null, or a number out of range, then element will be added at the end of the list.

Throws a "HierarchyRequestError" DOMException if element is an ancestor of the element into which it is to be inserted.

Syntax

collection.add(element[, before])

Parameters

element

An element.

before

A number or an element from collection.

Examples

1 · element · single

2 · element · multiple

3 · before · single

4 · before · multiple