I have a list of menu items and i want to add same class when a user clicks on any li or add class on hover li.
I have a menu items like following:
$('#menu li').click(function() {
$('#menu li').not(this).removeClass('active');
$(this).addClass('active');
});
$("#menu li").hover(
function () {
$(this).addClass('active');
},
function () {
$(this).removeClass('active');
});
http://jsfiddle.net/866pzu47/173/
the issue is if user clicks 'li' the class added to the li , when mouse over I need to remove the class added Due to the previous user click or again added the active iems.
Here is a simple way to do it
jsFiddle Demo
But still your requirement is not clear as much to draw on jsFiddle so please have a look and let us know what exactly you required within this.
Edited
I have just added to different classes one for click active and another for hover active so try hover and then click you will find different between both functions
Here is an updated jsFiddle.