Suppose you have html page that will display users profile with profile images and if image is not present, automatically missing image icon is appearing, it's looks unprofessional.
We can hide this icon or replace with the default image.
Simply Hide the missing image icon using Javascript:
<img id='ProfileImage' src='/images/1234.png' />
<script type="text/javascript">
var img = document.getElementById("ProfileImage");
img.onerror = function () { this.style.display = "none"; }
</script>
<img id='ProfileImage' src='/images/1234.png' />
<script type="text/javascript">
var img = document.getElementById("ProfileImage");
img.onerror = function () { this.style.display = "none"; }
</script>
No comments:
Post a Comment