get the text inside of an input javascript code example
Example 1: Javascript get text input value
var inputValue = document.getElementById("myTextInputID").value;
Example 2: javascript get value of input on button click
<form action="/">
<label for="">Whatever you want</label>
<input type="text" id='form'>
<input type="submit" id="submit">
</form>
<script>
const btn = document.getElementById('form');
btn.addEventListener('click', (e) => {
e.preventDefault();
const value = document.getElementById('submit').value;
console.log(value);
});
</script>