Skip to main content

Bug Tracker

Side navigation

#12366 closed bug (invalid)

Opened August 21, 2012 05:35PM UTC

Closed September 05, 2012 09:00AM UTC

Last modified November 16, 2012 02:38PM UTC

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:
Description

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)

THE SCRIPT WORKS PERFECTLY ON JQUERY v 1.6

Attachments (0)
Change History (5)

Changed August 21, 2012 05:43PM UTC by tonyhef comment:1

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

Changed August 21, 2012 06:24PM UTC by timmywil comment:2

owner: → 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.

Changed September 05, 2012 09:00AM UTC by trac-o-bot comment:3

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!

Changed November 16, 2012 02:32PM UTC by anonymous comment:4

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

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

Changed November 16, 2012 02:38PM UTC by dmethvin comment:5

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".