toggle method
Adds a token if it is not present, or removes it if it is. Returns true if the token is now present (it was added); returns false if it is not (it was removed).
![]() |
Syntax
var retVal = DOMTokenList.toggle(token);Parameters
- token [in]
-
Type: DOMString
- retVal [out, retval]
-
Type: boolean
Remarks
Throws a SyntaxError exception if token is empty.
Throws an InvalidCharacterError exception if token contains any spaces.
See also
Show:
