I want to get the favoriteid value.
<td class="favoriteRow" style="">
<img src="/images/starGold.png" loading="lazy" favoriteid="bitcoin">
</td>
This is what I tried but got back undefined.
console.log(this.childNodes[0]['favoriteid'])
The console.log(this) outputs:
<td class="favoriteRow" style="">
<img src="/images/starGold.png" loading="lazy" favoriteid="bitcoin">
</td>
Something like this?
See docs!
const img = document.querySelector("img[favoriteid]");
console.log( img.getAttribute("favoriteid") )
<td class="favoriteRow" style="">
<img src="/images/starGold.png" loading="lazy" favoriteid="bitcoin">
</td>
or
document.querySelector(".favoriteRow img").getAttribute("favoriteid")
console.log(document.querySelector(".favoriteRow img").getAttribute("favoriteid"));
<table>
<td class="favoriteRow" style="">
<img src="/images/starGold.png" loading="lazy" favoriteid="bitcoin">
</td>
</table>