REFERENCE

What this section covers:

  • Creating nodes
  • Duplicating nodes
  • Inserting nodes
  • Removing nodes
  • Replacing nodes
  • Manipulating nodes
  • Finding nodes
  • Node properties
  • Traversing the node tree

This section contains a list of some of the most useful methods and properties provided by the Document Object Model. They are arranged by task.

Methods

These methods are part of the DOM Core. This isn't a complete list of all the methods available. These are the most useful methods.

Creating nodes

Use these methods to create new nodes.

createElement

The createElement method creates a new element node with the specified tag name. This method returns a reference to the newly created element:

reference = document.createElement(element)

The method takes a ...

Get DOM Scripting: Web Design with JavaScript and the Document Object Model 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.