I am trying to temporarily change the content divto hover using this jQuery:
$(document).ready( function() {
var $ratingHtml = '';
$('.userRating').hover(
function() {
$ratingHtml = $(this).html();
alert($ratingHtml);
$(this).html( 'Log in to rate' );
},
function() {
alert($ratingHtml);
$(this).html( $ratingHtml );
}
);
});
However, when you hover, a warning appears twice - first for the original HTML content, and then for the "Sign in to rate" line. It looks like the second mouseover event is happening. How can I get around this?
source
share