Document.CreateElement method

In an HTML document, the document.createElement() method creates the HTML element specified by tagName, or an HTMLUnknownElement if tagName isn’t recognized.

public Element CreateElement(String localName)
localNameStringA String that specifies the type of element to be created. The nodeName of the created element is initialized with the value of tagName. Don’t use qualified names (like “html:a”) with this method. When called on an HTML document, createElement() converts tagName to lower case before creating the element.

Return Value

The new Element.


var element = document.CreateElement(tagName);

See Also