Help needed!
<div class="container">red</div>
<div class="container">green</div>
<div class="container">#eeeeee</div>
I am trying to dynamically set background colors for multiple divs based on their inner HTML content. For example, I want the background color of the first div to be red and the second div to be green, and so on.
Since I have over 50 div elements, writing individual CSS rules for each one would be too cumbersome. As a beginner in JavaScript, is there a way to achieve this with just a few lines of code?