+ 1
How to get user input?
I want to use <input> in HTML and use the value in JS. How?
2 ответов
+ 3
use DOM
var inputform = document.getElementById("inputform").value
+ 1
with value attribute
For example:
<input onchange="myFunction()" id="input"/>
<script>
function myFunction(){
var myValue = document.getElementById("input").value;
alert(myValue);
}
</script>