Can't change background-image in js | SoloLearn: Learn to code for FREE!


Can't change background-image in js

5/25/2020 6:52:42 PM

Сергей Куликов

4 Answers

New Answer


Right will be: var button = document.getElementById("playPauseButton");


Thank you all for your help.


In my code, I need to change the background image of the 'play' button with it's 'onclick' event. The console says it can't read property style of null. What is wrong in my code? Please, help me to correct my code and make it work.


Try adding this Сергей Куликов amigo var playPauseButton = "playPauseButton" or Make playPauseButton to "playPauseButton"