JavaScript Program to Get Value from the Textbox

Write a JavaScript program to get value from the textbox.



Source Code
<html>
<head>
<title>Get Value from the Textbox</title>
<script>
function display()
{
	var txt = document.getElementById('t1').value
	alert(txt);
}
</script>
</head>
<body>
<input type="text" id="t1">
<input type="button" value="Click" onclick="display()">
</body>
</html>
Output