How to output div from loop?

Hello everyone. How to output some div from loop??
And change its color for exampleScreenshot_1

Hi there @Klim_TV, and welcome to the community!

Once you have created a new <div> element and appended it to the DOM , the easiest way to change its background color is probably to directly set its inline background-color property, using something like this:

div.style.backgroundColor = 'red';

Every DOM element has a style property that allows you to get or set the element’s inline styles. So running the above line would result in the <div> being given the style like this:

<div style="background-color: red;"></div>

I’m assuming you’ve got a rule in your CSS that uses the selector .sq ? Does the classList line work?