Answers for "how to find input answer from text field html"

6

get value from textbox in vanilla javascript

document.getElementById("myText").value = "Johnny Bravo";
Posted by: Guest on May-25-2020
2

js get value from form input

// having form like this

<form>
  <div>
  	<label for="number">Give me number</label>
	<input type="number" id="number">
  </div>
  <div>
    <button class="btn">Click</button>
  </div>
</form>

// this is how u get a value (number)
document.querySelector("form").addEventListener("submit", get_number);
function get_number(e){
    const n = document.getElementById("number").value;
    console.log('n:', n)
    e.preventDefault();
}
Posted by: Guest on September-07-2020

Code answers related to "how to find input answer from text field html"

Browse Popular Code Answers by Language