We would like to know how to get Text from text input field from form button action.
<!-- www. ja v a 2 s . c o m-->
<html>
<head>
<script language="javascript" type="text/javascript">
function alertText()
{
var text = document.simpleForm.myText.value;
console.log(text);
}
</script>
</head>
<body>
<form name="simpleForm">
<input type="text" name="myText" size="20" />
<input type="button" value="Alert Text" onclick="alertText()" />
</form>
</body>
</html>
The code above is rendered as follows: