My code:
Array.from(document.querySelectorAll("[id^='MTG_INSTR$']") ).forEach( el => {
el.textContent = "Test";
});
This would be pass by value and won't make the assignment from what I've read.
Array.from(document.querySelectorAll("[id^='MTG_INSTR$']") ).forEach( el =>
{
arr[index].textContent = "test";
});
Should be a reference to each element and should work. But it's not. Is it because the array I create is unnamed, and thus I can't easily identify it?
My question - Why doesn't that second version work? It isn't making assignments on my chrome script, even though I know it's being executed. The page I'm on isn't displaying any changes, but every element beginning with MTG... should have its text content changed to "test".
It isn't. Why?
Edit:
Something like this:
Array.from(document.querySelectorAll("[id^='MTG_INSTR$']") )[0].textContent
Evaluated to the text, so I know the syntax is solid at least.
undefined