+ 2

Event Listener not working...

The addEventListener method, which I have added to two of my codes listed, is not working in Code Playground even though it's working on my desktop. I have no idea why... This is the code :- something.addEventListener('input', myFunction ); https://code.sololearn.com/WJFaA5BO3TAx/?ref=app https://code.sololearn.com/WQgkhGe4GkiL/?ref=app Thanks in advance 🙂

26th Nov 2017, 5:53 AM
🔭 GP 🔭
🔭 GP 🔭 - avatar
1 Answer
+ 5
Sololearn put the codes of Javascript pane in head tag. so Sololearn Javascript pane code is run from head tag before DOM elements loaded. You can't run DOM access code directly there, set window.onload callback function instead.
26th Nov 2017, 5:58 AM
CalviŐČ
CalviŐČ - avatar