I am using JQuery to dynamically add a link for an image file.
+ "<td><a class='IconButton' id='trkimg" + k + "' href='IMSTORE\/" + trackings[k].Image + "'><span class='ui-icon ui-icon-image'></span></td>"
This code checks that a value was returned from the database and hides the link if nothing was returned:
if (trackings[k].Image == null) { $("#trkimg" + k).html(""); $("#trkimg" + k).removeClass('CustomButton'); }
How can I use JQuery to validate that the file returned actually exists, and if it doesn't exist, display a different image?