setAttributeNS

The setAttributeNS JS Element sets the value of element’s attribute whose namespace is namespace and local name is localName to value.

Syntax

element.setAttributeNS(namespace, localName, value)

Parameters

namespace

A null or a non-empty string.

localName

A local name.

value

A string.

Examples

attachShadow

classList

className

closest

getAttribute

getAttributeNames

getAttributeNS

hasAttribute

hasAttributeNS

hasAttributes

id

innerHTML

insertAdjacentHTML

localName

matches

namespaceURI

outerHTML

prefix

removeAttribute

removeAttributeNS

setAttribute

shadowRoot

slot

tagName

toggleAttribute

Web Hypertext Application Technology Working Group (WHATWG)

Home Menu