I want to collect all the values from input fields and display them on the website.
Check out my code snippet below:
var button = document.querySelector("button");
button.addEventListener("click", function() {
var inputs = document.querySelectorAll("input").value;
for (i = 0; i < inputs.length; i++) {
inputs[i];
}
var output = document.getElementById("output");
output.innerHTML = "Here are the values: " + inputs;
});
<div>
<input type="number" min="1" max="49">
<input type="number" min="1" max="49">
<input type="number" min="1" max="49">
<input type="number" min="1" max="49">
<input type="number" min="1" max="49">
<input type="number" min="1" max="49">
</div>
<button>Check</button>
<div id="output"></div>