live become deprecated in jQuery 1.9. We can use on with mouseenter and mouseleave :
$(document).on("mouseenter", ".save-btn", function(e) { $(this).css("background-image","url('ie/imgs/btn/hover-btn.png')"); $(this).find("a").css("background-image","url('ie/imgs/btn/hover-btn-left.png')"); }); $(document).on("mouseleave", ".save-btn", function(e) { $(this).css("background-image","url('ie/imgs/btn/btn.png')"); $(this).find("a").css("background-image","url('ie/imgs/btn/btn-left.png')"); });
For some reason, I cannot use hover with on . It just doesn't work. But, from what I read, hovering is just an adaptation from mouseenter and mouseleave, so that's fine. ( fooobar.com/questions/428475 / ... )
If you do not need to support IE6, I recommend using :hover on your CSS (if this change is only in CSS, as the example above).
source share