Can't change background-image in js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
25th May 2020, 6:52 PM
Сергей Куликов
Сергей Куликов - avatar
4 Answers
+ 3
Right will be: var button = document.getElementById("playPauseButton");
25th May 2020, 7:22 PM
JaScript
JaScript - avatar
+ 2
Thank you all for your help.
25th May 2020, 7:25 PM
Сергей Куликов
Сергей Куликов - avatar
+ 1
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.
25th May 2020, 7:00 PM
Сергей Куликов
Сергей Куликов - avatar
+ 1
Try adding this Сергей Куликов amigo var playPauseButton = "playPauseButton" or Make playPauseButton to "playPauseButton"
25th May 2020, 7:24 PM
Subash
Subash - avatar