Name

createElement( ) — NN n/a IE 4 DOM n/a

Synopsis

createElement(”tagName“)

Generates in memory an instance of an object associated with the tag passed as a parameter to the method. Use this method to create new AREA and OPTION elements. You may then assign property values to fill out the features of the element, such as the src property of an image object. Any new element of these types must then be added to their collections (with the add( ) method).

Returned Value

Object reference.

Parameters

tagName

A string of the uppercase tag name of the desired new element: document.createElement("OPTION").

Get Dynamic HTML: The Definitive Reference 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.