I have simple image like this:
<img id="ddd" src="/someimage.jpg" /> <!-- valid image -->
Now on button click i change it like this:
<script>
function Change() {
$("#ddd").prop("src", "/someOtherImage.jpg"); <!-- valid image -->
}
</script>
and besides that i listen to when it is changed like this:
<script>
$(function() {
$("#ddd").on("load", function() {
alert("changed");
});
});
</script>
and like this it works but it doesn't work when i set it to invalid image like this:
<script>
function Change1() {
$("#ddd").prop("src", "/savsavsa.jpg"); <!-- invalid image -->
}
</script>
or
<script>
function Change1() {
$("#ddd").prop("src", "none"); <!-- invalid image -->
}
</script>
or
<script>
function Change1() {
$("#ddd").prop("src", "#"); <!-- invalid image -->
}
</script>
in none of 3 above chages it fires load event. I tried with change event but also not working. When i inspect that img it does change.