css - Return to default color with JQuery -


i have dropdown menu , i'am using mouseenter() function. if mouse enters selector's area background-color returning yellow. ıf leave selector's area want set default colour of selector's area without using mouseleave() function.

how can fix it?

$(document).ready(function(){     $("#l_ev_men").mouseenter(function(){         $(this).css("background-color","yellow");         $(this).css("color","black");     });      $("#l_ev_men").mouseleave(function(){ // ı dont want use function     }); }); 

it's better change class using toggleclass(). better, can simple without jquery using :hover css psuedo class.

.hoverable:hover {     background-color:yellow;     color:black; } 

then:

<li class="hoverable <otherstuff>">...</li>... 

or

<td class="hoverable <otherstuff>">...</td>... 

Comments