Reputation: 165
Still a Newbie using Javascript. I know something's wrong with my function code. I just can't restructure it well.
HTML:
<div class="column">
<img src="http://placehold.it/200x200&text=IMG1" onerror="imgError(this);" />
</div>
<div class="column">
<img src="httzp://placehold.it/200x200&text=IMG2" onerror="imgError(this);" />
</div>
JS:
function imgError(image) {
image.onerror = "";
parent('div.column').image.css('border','5px solid red');
return true;
}
Thanks in advance.
Upvotes: 0
Views: 96
Reputation: 18893
Try This:
function imgError(image) {
$(image).parent('div.column').css('border','5px solid red');
}
Upvotes: 2