Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

how to add active class to current element javascript

<script>
  function func(){
   document.getElementById('div').classList.add('active');
  }
</script>

<button onclick='func()'>Click</button>
<div id="div">
  This element gets 'active' class.
</div>
 
PREVIOUS NEXT
Tagged: #add #active #class #current #element #javascript
ADD COMMENT
Topic
Name
3+2 =