Skip to content
Permalink
cdd73996f5
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Latest commit 702ac2a Feb 10, 2020 History
1 contributor

Users who have contributed to this file

43 lines (31 sloc) 777 Bytes
<html>
<body>
<p>Color Picker</p>
<form id="color-picker">
<input type="color" id="page" name="page">
</form>
<script>
let picker = document.getElementById('page');
let body = document.querySelector('body');
const colorPicker = 'color-picker';
let allItems = JSON.parse( localStorage.getItem(colorPicker) );
picker.addEventListener('change', function(event) {
let.hex = this.value;
})
function updateFirst(event) {
var body = document.querySelector("body");
if (body) {
body.style.color = event.target.value;
}
}
function updateAll(event) {
document.querySelectorAll("body").forEach(function(body) {
body.style.color = event.target.value;
});
}
function storeColor() {
localStorage.setItem(colorPicker);
}
</script>
</body>
</html>