<html>
<body>
<input type="color" id="inputColor">
<input type="number" placeholder="Enter Number" id="inputDivNumber">
<button onclick="createDiv()">Create Div</button>
<button onclick="changeBackground()">Change Div Background</button>
<div id="output" class="divOutput"></div>
<script>
var div;
function createDiv() {
var i = 0;
var divValue = document.getElementById("inputDivNumber").value;
while (i < divValue) {
div = document.createElement("div");
//div.innerHtml=i;
i++;
div.setAttribute('class', 'divclass');
document.getElementById("output").appendChild(div);
}
}
function changeBackground() {
document.getElementsByClassName('.divclass').style.backgroundColor);
}
</script>
</body>
</html>