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

144
Vistas
Cannot read properties of undefined (beginner question)

So I have got this error saying 'Uncaught TypeError: Cannot read properties of undefined (reading 'style')' on line 97, a.style.textDecoration = 'line-through'; Can someone explain to me why it happened? I think I had 'a' defined in the same function. Thank you in advance!

I am trying to write a to do list. And when I click on the checkbox in front of the task, the task would be crossed out. Here is the code of the function with error...

function crossing(x){
    array1.forEach(function process(y){
        const a = document.getElementById(y.code).getElementsByTagName('div')[0];
        if(y.code===x.target.id){
            **a.style.textDecoration = 'line-through';**
        }
    })
}

Here is the link for all the codes... https://jsfiddle.net/PhilipWoo/x8dewa0s/

about 4 years ago · Juan Pablo Isaza
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