Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
finished color picker
  • Loading branch information
met18001 committed Feb 9, 2020
1 parent a6318f6 commit 06e7c29
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions week-2/color_picker.html
Expand Up @@ -16,13 +16,25 @@
<script>
let picker = document.getElementById('head');
let body = document.querySelector('body');



picker.addEventListener('change', function(event){
let hex = this.value;
body.style.backgroundColor = hex;
})

let newColor = this.value;
localStorage.setItem("color", hex);

});

window.addEventListener("load", function(event){
let hex = this.value;
localStorage.getItem("color", hex);
console.log(localStorage.getItem("color", hex));
body.style.backgroundColor = (localStorage.getItem("color", hex));

});





Expand Down

0 comments on commit 06e7c29

Please sign in to comment.