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

263
Vistas
Error de referencia no detectado: getweather no está definido en HTMLButtonElement.onclick (index.html:31)
<!DOCTYPE html> <html> <head> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Random Stuff</h1> <script> import fetch from "node-fetch"; function getweather(){ fetch('http://api.weatherapi.com/v1/current.json?key=f085cc2632a24b64965195959210710&q=84065&aqi=no') .then(response => response.json()) .then(data => { const weather = data.current.temp_f; setweather(weather); }) } function setweather(weather) { console.log(weather) document.getElementById("temp").innerHTML = weather; } </script> <input type="number" placeholder="Type something..." id="myInput", pattern="[0-9]*"> <button type="button" onclick="getweather()">Get Value</button> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </body> <button onclick="getweather()", id="id">Click me</button> <h1>The weather is:</h1> <h2 id="temp"></h2> </html>

Aquí tengo mi archivo HTML y cada vez que hago clic en un botón aparece el error (en el título) He estado tratando de averiguar por qué esto no funciona, acabo de comenzar HTML, CSS y JS, la respuesta puede ser obvia pero parece que no puedo arreglarlo.

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