Answers for "add active class"

CSS
0

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>
Posted by: Guest on June-16-2021
0

button active css

form :active {
  color: red;
}

form button:active {
  background: black;
}
Posted by: Guest on December-06-2020

Browse Popular Code Answers by Language