Reputation: 7663
How do i use an "or" statement in jquery, i have two separate statements that i think i can combine to be just one:
$('li.members').hover(function() {
$('.members-show').show();
$('.brokers-show').hide();
$('.providers-show').hide();
$('.employers-show').hide();
$('.seniors-show').hide();
return false;
});
$('li.members-active').hover(function() {
$('.members-show').show();
$('.brokers-show').hide();
$('.providers-show').hide();
$('.employers-show').hide();
$('.seniors-show').hide();
return false;
});
Upvotes: 5
Views: 2962
Reputation: 11876
$('li.members, li.members-active').hover(function() {
$('.members-show').show();
$('.members-show, .providers-show, .employers-show, .seniors-show').hide();
return false;
});
Upvotes: 10
Reputation: 328566
Try the Multiple Selector:
$('li.members,li.members-active').hover(function() {
$('.members-show').show();
$('.brokers-show').hide();
$('.providers-show').hide();
$('.employers-show').hide();
$('.seniors-show').hide();
return false;
});
Upvotes: 1
Reputation: 17732
$('li.members, li.members-active').hover(function() {
$('.members-show').show();
$('.brokers-show').hide();
$('.providers-show').hide();
$('.employers-show').hide();
$('.seniors-show').hide();
return false;
});
Upvotes: 16