I have this script to cause a background color on a paragraph on hover of link within the paragraph. What I don\'t know how to do is cause it to return to the original backgroun
If you must use jQuery for this, use addClass()
rather than css()
:
$('.box a').hover(function(){
$(this).closest('.box').addClass('hoveredOver');
}, function(){
$(this).closest('.box').removeClass('hoveredOver');
});
With the CSS:
.hoveredOver {
background-color: #fff;
}
JS Fiddle demo.
References: