I'm trying to write a chrome extension that(for now) changes the background color of elements that have a certain 'class name'. This code(content script) doesn't work:
let divs = document.getElementsByClassName('arbitrary-class-name');
for (let el of divs) {
el.style['background-color'] = 'FFF298';
}
I got "Uncaught TypeError: divs is not iterable" when i tried to execute. I also tried to inspect the source code and i noticed that all the elements that i wanted to get, are dynamically created during loading, maybe my code is trying to access elements that don't exist yet?
edit: this is the page i'm trying to work with, for instance i want to change the background color of all 'partecipante-info' divs.
edit2: This code always runs after my script:
XHR finished loading: POST "https://some-link".
send @ jquery-1.12.4.js:10254
ajax @ jquery-1.12.4.js:9738
(anonymous) @ genera_tabellone_v2.js:15
fire @ jquery-1.12.4.js:3232
fireWith @ jquery-1.12.4.js:3362
ready @ jquery-1.12.4.js:3582
completed @ jquery-1.12.4.js:3617