Answers for "Uncaught (in promise) DOMException: Failed to execute 'add' on 'DOMTokenList': The token provided ('alert alert-danger') contains HTML space characters, which are not valid in tokens."

0

Uncaught (in promise) DOMException: Failed to execute 'add' on 'DOMTokenList': The token provided ('alert alert-danger') contains HTML space characters, which are not valid in tokens.

//Well, class names cannot contain spaces, because the space separates multiple class names from each other. For example, if your HTML contains

class="zocial button"
//it means that this element has two classes, "zocial" and "button".
//If you want to add both of these classes, you have to pass each one as argument to the method:

buttonz[i].classList.add('zocial', 'button');
Posted by: Guest on August-16-2021

Code answers related to "Uncaught (in promise) DOMException: Failed to execute 'add' on 'DOMTokenList': The token provided ('alert alert-danger') contains HTML space characters, which are not valid in tokens."

Code answers related to "Javascript"

Browse Popular Code Answers by Language