jQuery hover event firing twice on mouse over -


I try to temporarily change the content of div on the hover, using this jQuery I'm doing:

  $ (document) .ready (function () {var $ ratingHtml = ''; $ ('. UserRating'). Hover (function () {$ ratingHtml = $ (This) HTML (); Alert ($ Rating HTML); $ (this) .hmml ('To Into');}, Function () {Alert ($ Rating HTML); $ (this) .html $ Rating html);});});  

However on the hover, the alert appears twice - first for the original HTML content, then for 'log in for the string'. It seems like another mouseover event happens, how do I work around it?

I decided to go with a different solution - an overlay:

  $ ('. UserRating'). Hover (function () ($ ('& lt; div class = "loginMsg" & gt; Login to rate & lt; / div & gt;') AppendTo ('. UserRating');}, function () {$ ('. Logms'). Remove ();});  

With appropriate styles in CSS


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -