Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js update css class name

document.getElementById("MyElement").classList.add('MyClass');

document.getElementById("MyElement").classList.remove('MyClass');

if ( document.getElementById("MyElement").classList.contains('MyClass') )

document.getElementById("MyElement").classList.toggle('MyClass');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #update #css #class
ADD COMMENT
Topic
Name
4+9 =