-2

So i need to change my website background dynamically from this class . I'm not familliar with js so i want to ask for ur help. Ty all.

<div class="text-center AnimeImage col-xl-3 col-md-6" id="AnimeImage">
<img src="https://cdn.discordapp.com/attachments/757324382426103878/799973669136629770/204129.png" alt="Enmusubi no Youko-chan" class="AnimeImg img-effect">
</div>
Amachi
  • 27
  • 5

1 Answers1

-1

You can but css is going to be a better route.

to do it with javascript you have to grab the class and give it a variable

var bgDiv = document.getElementByClassName("yourClassName")

then set it with styles

bgDiv.styles.backgroundColor = "blue"

jeffyd193
  • 40
  • 6