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

128
Vistas
Why getAttribute does not return option field name?

I have this React code in return:

I would fetch and store key value on option, when select is changing.

<select
  className={"select_1"}
  onChange={(event: React.ChangeEvent<HTMLSelectElement>) => {
    let startPaymentIn2 = { ...startPaymentIn };
    var selectedIndex = event.target.options.selectedIndex;
    startPaymentIn2["pricingOptionId"] = event.target.options[
      selectedIndex
    ].getAttribute("key");
    setStartPaymentIn(startPaymentIn2);
  }}
>
  {Object.entries(buyTicketData?.pricingOptions).map(([key, value]) => (
    <option key={key}>{value.name}</option>
  ))}
</select>;

For some reason getAttribute("key"); return null, why?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

key is a React prop that doesn’t get passed through to the DOM. It’s not on the rendered element.

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