I have two buttons which im working with, I am trying to make a hover effect and when the user clicks on the button have a clicked event.
I have been playing around with a few jquery methods such as mouseover mouseout etc but still no luck. The idea is to get the hover to only work on elements that have not been selected already.
The issue with the code below is that once an button has been selected if the user hovers over the selected method it gets rid of its current state.
Is their a way of not getting rid of the current state once a button has been selected?
Thanks
$(".M").click(function(){
$(this).css('background-color','#515B69');
$(this).css('color','#fff');
$(".F").css('color','#515B69');
$(".F").css('background-color','#fff');
});
$(".M").mouseover(function() {
$(this).css('background-color','#515B69');
$(this).css('color','#fff');
});
$('.M').mouseleave(function(){
$(this).css('color','#515B69');
$(this).css('background-color','#fff');
});
$(".F").click(function(){
$(this).css('background-color','#515B69');
$(this).css('color','#fff');
$(".M").css('color','#515B69');
$(".M").css('background-color','#fff');
});
$(".M").mouseover(function() {
$(this).css('background-color','#515B69');
$(this).css('color','#fff');
});
$('.F').mouseleave(function(){
$(this).css('color','#515B69');
$(this).css('background-color','#fff');
});