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

127
Views
I created a DOM event that isn't giving me the result I wanted

I created a function to change the color value of my elements. I used the same function on both elements with different events but my second element isn't changing only the first element.

function colorChange(event){
  let randomColor = 'rgb(' + colorValue() + ',' + colorValue() + ',' + colorValue() + ')';
  button.style.backgroundColor = randomColor
}

button.addEventListener('click', colorChange);
mysteryButton.onwheel = colorChange;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Maybe you should try instead

function colorChange(event){
  let randomColor = 'rgb(' + colorValue() + ',' + colorValue() + ',' + colorValue() + ')';
  event.target.style.backgroundColor = randomColor
}

button.addEventListener('click', colorChange);
mysteryButton.onwheel = colorChange;
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!