Reputation: 3393
<a href="random-link">
<img alt="My Photo" class="profile-img" height="80" src="img" width="80">
</a>
how do you apply this jquery .attr('target','_blank');
to the <a href="link">
so the outcome will be
<a href="random-link" target="_blank">
<img alt="My Photo" class="profile-img" height="80" src="img" width="80">
</a>
Upvotes: 1
Views: 598
Reputation: 179176
Just in case @Yusaf was using link
as an ambiguous link, you could try this instead:
$('.profile-img').parent('a').attr('target', '_blank');
Upvotes: 3