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

195
Views
¿Cómo llamar a la función desde un archivo js externo?

Estoy tratando de incrementar un botón al hacer clic desde un archivo js externo. Cuando hago clic en el botón, aparece un mensaje de error que me dice que el incremento de mi función no está definido. ¿Cómo llegar a una función para un archivo js externo en html? Gracias por adelantado. sandbox index.html

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>webpack starterkit</title> </head> <body> <div id="app"> <h1>People entered:</h1> <h2 id="count-el">0</h2> </div> <button id="increment-btn" onclick="increment()">Increment</button> <script type="text/javascript" src="scripts/index.js"></script> </body> </html>

índice.js

 let count = 0; let countEl = document.getElementById("count-el"); console.log(countEl); document.getElementById("count-el").innerText = count; function increment() { count = count + 1; countEl.innerText = count; } increment();
about 4 years ago · Juan Pablo Isaza
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!