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

145
Views
eventlistener and window.onload not working for me

I've tried several things to make it work. It worked before when I hosted it all on the same file, but now it won't work when I separated it on my script.js.

this is part of my code

var buttonStart = document.getElementById("forward");
var buttonStop = document.getElementById("stop");

buttonStart.addEventListener("click", speedup);

function speedup() {
  clearInterval(Interval);

  speed = speed + 1;

  Interval = setInterval(valuecalc, 1000 / speed);
  document.getElementById("speed").innerHTML = speed;
};

buttonStop.addEventListener("click", stopspeed);

function stopspeed() {
  clearInterval(Interval);
  speed = 0;
  document.getElementById("speed").innerHTML = speed;
};

var starts = start();
window.onload = starts;

Here's the live demo it's a sort of clicker game I'm working on: https://jobclicker.netlify.app/

This is my error: script.js:35

Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') at script.js:35:17

about 4 years ago · Santiago Gelvez
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!