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

314
Views
JavaScript How to run function when value changes

I want to run a function that presses a button on site when a number of users changes. I tried doing this with addEventListener and .onchange but first method isn't working at all and second method is running a function right away even when value of users hadn't chanded.

//first method
var ludziki = document.getElementById('online');
ludziki.addEventListener('change',function()
{
document.querySelector('button.gray_inline.button_amount_r').click();
});

//second method
var ludziee = document.getElementById('online');
ludziee.onchange = coraz();
function coraz()
{
  document.querySelector('button.gray_inline.button_amount_r').click();
} 

219 is the value that im referring to and that value seen on site on which i want to run my script

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

0

But what is the online element? Because if was like this could work:

//first method
var ludziki = document.getElementById('online');
ludziki.addEventListener('change',function()
{
document.querySelector('button.gray_inline.button_amount_r').click();
});
<input type='text' id='online'>

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!