I am trying to change the image on mousedown
and revert back to the initial image on mouseup
.
The image is changing on mousedown
but it is not reverting to the initial image on mouseup
.
The alert in the mouseup
function doesn't appear... What is going wrong?
$(#mydivid).bind('mousedown', function() {
document.getElementById(mydivid).style.backgroundImage = "url(Images/new.png)";
alert("mousedown");
});
$(#mydivid).bind('mouseup', function() {
document.getElementById(mydivid).style.backgroundImage = "url(Images/initial.png)";
alert("mouseup");
});
I have observed that when I bind more than one event to the same div, the first eventhandler works and the others are ignored... How do I ensure that all events are handled?