Alright so when I add a id tag to a html element [ <div id = 'test'>hi<div> ] and use [ document.querySelector("#test").style.backgroundColor = "green"; ], it works.
However the second I use [ mainwindow.id = 'test'; ] in [ const mainWindow = document.createElement("div"); document.body.appendChild(mainWindow); mainwindow.id = 'test'; ] it doesn't work! Why is this happening? if you find it out please let me know.
(Sorry for the messy code I'm making a bookmarklet application)
However the second I use [ mainwindow.id = 'test'; ] in [ const mainWindow = document.createElement("div"); document.body.appendChild(mainWindow); mainwindow.id = 'test'; ] it doesn't work! Why is this happening? if you find it out please let me know.
(Sorry for the messy code I'm making a bookmarklet application)
Last edited: