How to access and change the body of HTML from within P5

Newbie here - been playing with P5 and the DOM - adding DOM elements and changing their properties in code. The one thing i'm stuck on is accessing and modifying the background colour of the webpage. iI tried adding an ID of 'bod' to the body tag in the index file. That lets me target it in CSS and change the colour. But when I try this instead in the P5 code it doesn't work: var b; b = document.getElementById("bod"); b.style("background-color","#FFFF22");

the first line doesn't stop the program executing but the second one does. Can anyone point me in the right direction? thanks

Answers

Sign In or Register to comment.