Skip to content
Advertisement

Local storage to change background colour

I am trying to change the background colour of my website with local storage. I am using onchange() within the HTML for the colours() function, and the rest is the JavaScript below

JavaScript

It does nothing. It doesn’t even change, let alone store it as local storage.

I keep missing vital, small parts of code and it feels like I have done it again with this one.

Any help is greatly appreciated!

HTML:

JavaScript

Advertisement

Answer

the code is wrong, you are improperly setting and checking localStorage values. Also, you need to get the value from the node with id party.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement