I have the following image element that it's src does not exists. I want to use the jquery error function to detect if it has not loaded and replace the src with a generic image that I know exists. This works in chrome and firefox but on in IE. Why does this not work in IE and are there any workarounds? Thanks!
<img id="main" src="missing-image.jpg" />
<script type="text/javascript">
$(function () {
$("#main").error(function () {
$("#main").attr("src", "generic.jpg");
});
});
</script>