Search
 
SCRIPT & CODE EXAMPLE
 

HTML

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>
Comment

Adding active Class with JavaScript

$("#navMenus").on('click','li',function(){
     $(this).addClass("active");  // adding active class
});
Comment

PREVIOUS NEXT
Code Example
Html :: vs code view release notes 
Html :: how to save time writing html 
Html :: larger checkbox html 
Html :: email button html 
Html :: tailwind css search bar 
Html :: faire un footer avec bootstrap 
Html :: change font size of h1 in html 
Html :: divider bootsrap 
Html :: how to add function to button in html 
Html :: html if screen is smaller thatn 
Html :: how to make text uppercase html 
Html :: how to break the line in html 
Html :: range input html 
Html :: page break html 
Html :: bootstrap switch change text 
Html :: where are mac notes stored 
Html :: html element hover helptext 
Html :: html scale svg 
Html :: input form 
Html :: html js script 
Html :: create a container in html 
Html :: dl in html 
Html :: bootstrap nav nav tabs float right 
Html :: laravel apache config 
Html :: links in html 
Html :: how to insert code in html 
Html :: delete icon in html 
Html :: color picker js 
Html :: transparent navbar 
Html :: change source of iframe attribute target 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =