add()


Adds an element to the instance.

Syntax
Nestable.add([element, [parent]])

Accepts a valid HTMLElement node, instances of HTMLCollection and NodeList or an array of items as the first argument.

You can define the parent to which the new item will be appended to with the second argument. Defaults to the main list.


Demo

  1. Item 1
  2. Item 2
    1. Item 3
    2. Item 4
  3. Item 5
  4. Item 6
  5. Item 7
  6. Item 8