Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#12366 closed bug (invalid)

Error on hover+mouseleave+mouseenter when they must change html content

Reported by: tonyhef Owned by: tonyhef
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:


This is the code:

$('.button_std').mouseenter(function(){ $(this).html('<img src="images/'+$(this).attr('name')+'_hov.png" />');


$('.button_std').mouseleave(function(){ $(this).html('<img src="images/'+$(this).attr('name'+'.png" />');


function on mouseenter event works, but mouseleave event not works or not work well, in fact, this event is never invoked.

If, instead, I disable mouseenter event, mouseleave event works...

I found the problem with IE9, Chrome v20 and firefox v14, and jquery version 1.7.1 and the last (1.8.0)


Change History (5)

comment:1 Changed 11 years ago by tonyhef

however, in 1.6 works correctly on chrome and firefox, but not on ie9

comment:2 Changed 11 years ago by Timmy Willison

Owner: set to tonyhef
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/. Open the link and click to "Fork" (in the top menu) to get started.

comment:3 Changed 11 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:4 Changed 11 years ago by anonymous

This still happens when using html(). If you use .attr() it works fine.

$(this).find("img").attr("src", hoverimagename )

comment:5 Changed 11 years ago by dmethvin

Not all that surprising, you're modifying the internal content of the element. The element that was mouseentered is removed so I guess the browser decides to not fire the mouseleave event. In any event, it's not something jQuery can or should "fix".

Note: See TracTickets for help on using tickets.