Hover style or css with jQuery for changing background color of element in website

Following code will clearly show you idea to change background color of a button/link when use hovers mouse on it.


jQuery(".mybuttonblue").hover(
function() {
jQuery(this).css("background-color", "#565656");
}
);
jQuery(".mybuttonblue").mouseout(
function() {
jQuery(this).css("background-color", "#838383");
}
);

Above method is useful when your css class definition does not contain background color facility, and still you want it.

Advertisements