+ 3

[SOLVED] Why does addEventListener not work on onChange event?

Why does Range 1 work but not Range 2? Why does Range 2 call log2() without user changing it's value? https://code.sololearn.com/WjVSpkAi8Rfj/?ref=app

23rd Jul 2020, 11:13 AM
Ćheyat - avatar
1 Answer
+ 6
It's: r2.addEventListener('change' , log2); instead of log2(), you need to write log2, because otherwise you're just calling the function first time and that's it, you need to pass the function itself
23rd Jul 2020, 11:22 AM
Bagon - avatar