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

369
Views
Uncaught ReferenceError: <function> is not defined at HTMLButtonElement.onclick when use Browserify

I am trying to use MYSQL NodeJS with BROWSERIFY and face this problem

HTML code

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

connectdb.js code

  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)
  
});});}

I used browserify like this

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

But when i click the button the console show error:

Uncaught ReferenceError: abc is not defined at HTMLButtonElement.onclick

Can someone please suggest a solution?

Thanks

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

0

did u included ur connectdb.js into ur HTML? if not u have to add this to ur 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!