I am new to jQuery and trying to figure out how to use the .hover(); effect in place of the .mouseover() and .mouseout() effects. Here is the scenerio:
I am using a table and want to highlight the row with a CSS class that changes the background color to a light yellow. Here is the CSS:
.bgHvr {
background-color: #FFFACD;
}
The only way I know how to add the hover effect I desire is:
jQuery(document).ready(function($) {
$('#table tbody tr').mouseover(function() {
$(this).addClass('bgHvr');
});
$('#table tbody tr').mouseout(function() {
$(this).removeClass('bgHvr');
});
});
UPDATE:
After some more help I found out a simpler way of a hover effect:
$('#table tbody tr').hover(function() {
$(this).toggleClass('bgHvr');
});
This is possible after the 1.4.2 update to jQuery which changed how the .toggle() effect worked.