#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: |
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
Change History (5)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Owner: | set to tonyhef |
---|---|
Status: | new → pending |
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
Resolution: | → invalid |
---|---|
Status: | pending → closed |
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
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
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".
however, in 1.6 works correctly on chrome and firefox, but not on ie9