How to change background-image of a css element using JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to change background-image of a css element using JavaScript

I have a section and i want to change the background-image of it every 5 seconds , the images will be in array called img. i've tried selecting the section and the use .style.backgroundImage but it didn't work any idea will be helpful thanks

1st Dec 2020, 10:08 AM
Djaber Meghar
Djaber Meghar - avatar
2 Answers