0
How can i get input in javascript using html forms
3 Answers
+ 4
Try this:
<form name="myform" onsubmit="getName(event)">
<input type="text" name="yourname" />
<input type="submit" />
</form>
<script>
function getName(e) {
e.preventDefault();
alert(myform.yourname.value);
}
</script>
+ 2
Just change alert to document.write
0
i want to save that input in a js variable from html form