add active class to li onclick jquery

add active class to li onclick jquery Question: – How can add class “Active” on click of an li element and remove it from others at the same time?

add active class to li onclick jquery

Query : How to add class (active) on specific li on user click with jQuery? – Loop through the buttons and add the active class to the current/clicked button.

$("#menu li a").click(function() {
    $(this).parent().addClass('selected').siblings().removeClass('selected');
});

Add active class to a div on javascript onclick event

index.html
create a ul menu with li items



    
        
        
    
    
        
Click to make Active

Add active class onclick javascript to HTML ul List to make menu

index.html



    
        
        
    
    
        
        
    


Add active class to a div on Jquery onclick event

index.html



    
        
        
    
    
        
Click to make Active

Add Hover effect in HTML menu using JQuery hover()

index.html



    
        
        
    
    
        
       
        
        
    

$( "a" ).hover(function() {
      $(this).parent("li").addClass("hover");
  }, function() {
      $(".menu li").removeClass("hover");
});

Don't Miss : Add and remove active class onclick jquery

I hope you get an idea about add active class to li onclick jquery.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment