Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

change class js

let containsClass = element.classList.contains('my-class');
element.classList.toggle('my-class', !containsClass);
Source by stackabuse.com #
 
PREVIOUS NEXT
Tagged: #change #class #js
ADD COMMENT
Topic
Name
6+1 =