46
rated 0 times
[
49]
[
3]
/ answers: 1 / hits: 41088
/ 7 Years ago, wed, january 3, 2018, 12:00:00
so my question is pretty simple.
How to I get user input from a form and put it into a variable ?
Im struggling to do this simple task and would appreciate some help.
Here is my code :
html:
<body>
<form>
<input type=text id=input_id value=>
<input type=submit value=Submit>
<div id=alert style=color: red></div>
</form>
</body>
Javascript
var a = document.getElementById('input_id').value;
function wawa() {
return a;
}
document.getElementById('alert').innerHTML = user entered this value: + + a;
I would like to do this with vanilla JS and no library.
Thanks.
More From » html