1// having form like this
2
3<form>
4 <div>
5 <label for="number">Give me number</label>
6 <input type="number" id="number">
7 </div>
8 <div>
9 <button class="btn">Click</button>
10 </div>
11</form>
12
13// this is how u get a value (number)
14document.querySelector("form").addEventListener("submit", get_number);
15function get_number(e){
16 const n = document.getElementById("number").value;
17 console.log('n:', n)
18 e.preventDefault();
19}
20