Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
TypeError no capturado: no se pueden establecer propiedades de indefinido (estableciendo 'color')

 document.querySelectorAll('button').forEach (function(button){ button.onclick=function(){ document.querySelector('#hello').Style.color=button.dataset.color; } });
 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <h1 id="hello">Hello wprld</h1> <button data-color="red">Red</button> <button data-color="green">green</button> <button data-color="blue">Blue</button> </body> </html>

// Intentando cambiar el color de la etiqueta cuando el usuario hace clic en ella // Intentando implementar esta función pero mostrando el mismo estilo de error no puede ser nulo

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Es sensible a mayúsculas y minúsculas. No es "estilo", es "estilo". Cuando dice indefinido, comprueba si existe.

 document.querySelectorAll('button').forEach (function(button){ button.onclick=function(){ document.querySelector('#hello').style.color=button.dataset.color; } });
 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <h1 id="hello">Hello wprld</h1> <button data-color="red">Red</button> <button data-color="green">green</button> <button data-color="blue">Blue</button> </body> </html>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!