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

370
Views
Error de referencia no detectado: <función> no está definida en HTMLButtonElement.onclick cuando se usa Browserify

Estoy tratando de usar MYSQL NodeJS con BROWSERIFY y enfrento este problema

Código HTML

 <button type="button" onclick="abc()" >xyz</button> <script type="text/javascript" src="./bundle.js"></script>

código connectdb.js

 function abc(){ con.connect(function(err) { if (err) throw err; con.query("SELECT * FROM database_nmcnpm_nhom1.users", function (err, result) { if (err) throw err; else console.log(result) });});}

Usé browserify así

browserify ./connectdb.js -o ./bundle.js

Pero cuando hago clic en el botón, la consola muestra un error:

Error de referencia no capturado: abc no está definido en HTMLButtonElement.onclick

¿Puede alguien sugerir una solución?

Gracias

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

0

¿Incluiste tu connectdb.js en tu HTML? si no, tienes que agregar esto a tu html:

 <script type="text/javascript" src="./connectdb.js"></script>
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!