I am trying to save two values, one for the h1 tag and one for the body background. I want the user to select color 1 and color 2. When I press the third button, all changes should be applied and the colors should change. I have attempted this but with no success :(
(html)
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>All the elements</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="h1tag">
<ul>
<h1> This is a title</h1>
<li>Paragraph 1: I went on a trip</li>
<li>Paragraph 2: and I took with me</li>
<li>Paragraph 3: an extension cord</li>
<li>Paragraph 4: and a flashlight</li>
</ul>
</div>
<button type="button" onclick="saveUserData()" class="button0">Save Background Color</button>
<input id="color0" type="color" value="#ff0000">
<button type="button" onclick="saveUserData()" class="button1">Save Title Color</button>
<input id="color1" type="color" value="#ff0000">
<button onclick="applyColors()">Apply Colors to Page</button>
</body>
<footer>
<script defer src="script.js"></script>
</footer>
</html>
(javascript)
function applyColors() {
var h1 = document.querySelector(".h1");
var backgroundColor = document.getElementById("color0").value;
var h1Tag = document.querySelector(".h1tag");
var titleColor = document.getElementById("color1").value;
document.body.style.backgroundColor = backgroundColor + " " + titleColor;
}