var img = $("#imgElem").attr('src', 'http://somedomain.com/image.jpg') .load(function() { if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { alert('broken image!'); } else { $("#something").append(img); } });
Reference:
沒有留言:
張貼留言
留個話吧:)