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

173
Views
How do I make a console.log() print the value selected on a range input?
input.addEventListener('click', () => {
    let input = document.getElementById('myRange').value
    console.log(input.value)
    if (input === '1'){
        theme1()
    }
    if (input === '2'){
        theme2()
    }
})

The console.log(input.value) shows undefined. I want them shows me the value selected on input every time I click on it.

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

0

In your code you're setting input to the value and then trying to do .value so essentially you're doing input.value.value

Changing your code to

input.addEventListener('click', () => {
    const value = document.getElementById('myRange').value
    console.log(value)
    if (value === '1'){
        theme1()
    }
    if (value === '2'){
        theme2()
    }
})

Will solve it

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!