createElementNS

The createElementNS JS Document returns an element with namespace namespace. Its namespace prefix will be everything before U+003A (:) in qualifiedName or null. Its local name will be everything after U+003A (:) in qualifiedName or qualifiedName.

If qualifiedName does not match the QName production an "InvalidCharacterError" DOMException will be thrown.

If one of the following conditions is true a "NamespaceError" DOMException will be thrown:

Namespace prefix is not null and namespace is the empty string.

Namespace prefix is "xml" and namespace is not the XML namespace.

qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace.

namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns".

When supplied, options’s is can be used to create a customized built-in element.

Syntax

element = document.createElementNS(namespace, qualifiedName [, options])

Parameters

namespace

A null or a non-empty string.

qualifiedName

A qualified name.

options

is

Used to create a customized built-in element.

Examples

1 · namespace qualifiedName

2 · options

adoptNode

characterSet

compatMode

contentType

createCDATASection

createComment

createDocumentFragment

createElement

createProcessingInstruction

createTextNode

doctype

Document

documentElement

documentURI

exitPictureInPicture

getElementsByClassName

getElementsByTagName

getElementsByTagNameNS

implementation

importNode

pictureInPictureEnabled

URL

write

writeln

Web Hypertext Application Technology Working Group (WHATWG)

Home Menu