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

174
Vistas
not working as expected events via HTML can't be called in script

HTML:

<body>
  <script type="module" src="./script.js"></script>
  <div>Welcome to my first html page...</div>
  <div id="username">Another div tag</div>
  <p>This is a paragraph</p>
  <h1>Working on JS</h1>
  <button onclick="firstFunction()">Click</button>    
</body>

J/S:

function firstFunction() {
  console.log("Hurry")
}        

Getting error:

Uncaught ReferenceError: firstFunction is not defined

    at HTMLButtonElement.onclick (index.html:17)

onclick @ index.html:17

What might be the cause of this error?

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

Don't import the js script as module. use the following code instead :

<script src="./script.js"></script> `
about 4 years ago · Santiago Gelvez 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