• 0 Posts
  • 16 Comments
Joined 1 year ago
cake
Cake day: June 28th, 2023

help-circle


  • The script attempted to modify a div’s background color using document.body.removeChild, but as the script was loaded in the HTML head, the DOM had not loaded

    Isn’t that how it works/always worked? When i was learning html/js ages ago i had to use some event listener (DOMContentLoaded i think) or put the script just before </body> (for any code that should run on load and interacts with the DOM).

    And how do you change the background by removing a child?