Answers for "how to add active class in therd element js"

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

Adding active Class with JavaScript

$("#navMenus").on('click','li',function(){
     $(this).addClass("active");  // adding active class
});
Posted by: Guest on December-02-2021

Code answers related to "how to add active class in therd element js"

Browse Popular Code Answers by Language