Reputation: 652
Current HTML
<td rowspan="3" class="brandlogo">
<a href="http://www.myfantasyleague.com/">
<img src="http://www5.myfantasyleague.com/images/new_mfl_logo.png" alt="http://www.myfantasyleague.com/" border="0" height="80" width="80">
</a>
</td>
I need to use jquery to replace so the output would be
<td rowspan="3" class="brandlogo">
<a href="newurl">
<img src="newimagesource" alt="" border="0" height="80" width="80">
</a>
</td>
Upvotes: 0
Views: 53
Reputation: 7640
You can use prop()
to set new values
$("td>a").prop("href", "newurl");
$("td>a>img").prop("src", "newimagesource");
$("td>a>img").prop("alt", "")
Upvotes: 0
Reputation: 85545
Like this:
var href = "newurl";
var imgPath = "newimagesource";//"newimagesource.jpg"
$('.brandlogo a').attr('href',href);
$('.brandlogo a img').attr('src',imgPath);
Upvotes: 1