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

160
Views
console.log does not work onclick event when the files are in XAMPP

I want to display data in the console.log() when a button is clicked . so my code is

  let btn = document.getElementById('myBtn');
        btn.addEventListener('click', function() {
            console.log('button clicked !!')
        })
<button id="myBtn">click</button>

This code works fine as expected , But When open the file from the local host XAMPP ; the data is not displayed on the console , i tried to use alert() instead , it woks fine , i tried also to move the console.log('clicked!!') outside the event callback function , it woks fine also!! but as long as it is inside the function it does not work on the click event .

here is a i recorder for better understanding => https://youtu.be/6xYowU8l7hM

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!