Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

90
Vistas
Retrieve value from img tag

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>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

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>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda