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.
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