+ 6
Why not working?
3 Answers
+ 6
I do not know why you would write:
if(el1)
https://code.sololearn.com/W9C95bwVKaxr/?ref=app
but here is the fixed code. I removed the if statement from the event Listeners section and made them get added only after Dom is loaded. ;)
+ 6
window.onload = function()
{
// add event listener for the 3 elements here
}
At the moment the code refers to elements before the DOM is fully setup, the elements you refer to, are not yet prepared to be used.