Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

toggleAttribute

Description

The toggleAttribute of Element for JS if force is not given, "toggles" qualifiedName, removing it if it is present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName.

Returns true if qualifiedName is now present; otherwise false.

Syntax

element.toggleAttribute(qualifiedName [, force])

Parameters

qualifiedName

A qualified name.

force

A boolean.

Examples

1 · qualifiedName · remove

2 · qualifiedName · add

3 · force · false

4 · force · true

5 · return · false

6 · return · true

attachShadow

classList

className

closest

getAttribute

getAttributeNames

getAttributeNS

hasAttribute

hasAttributeNS

hasAttributes

id

innerHTML

insertAdjacentHTML

localName

matches

namespaceURI

outerHTML

prefix

removeAttribute

removeAttributeNS

setAttribute

setAttributeNS

shadowRoot

slot

tagName

Web Hypertext Application Technology Working Group (WHATWG)

HomeMenu