javascript getting value from input code example
Example 1: Javascript get text input value
var inputValue = document.getElementById("myTextInputID").value;
Example 2: get value from textbox in vanilla javascript
document.getElementById("myText").value = "Johnny Bravo";
Example 3: js get value from form input
<form>
<div>
<label for="number">Give me number</label>
<input type="number" id="number">
</div>
<div>
<button class="btn">Click</button>
</div>
</form>
document.querySelector("form").addEventListener("submit", get_number);
function get_number(e){
const n = document.getElementById("number").value;
console.log('n:', n)
e.preventDefault();
}