Articles → JavaScript → Document.Getelementbyid In Javascript
Document.Getelementbyid In Javascript
Purpose
Example
<html>
<head>
<script language="javascript" type="text/javascript">
function ClickMe()
{
alert(document.getElementById("txtName").value);
}
</script>
</head>
<body>
<form method="post" action="GetElementByIDPage.html">
<input type="text" id="txtName">
<input type="button" value="click" onclick="javascript:ClickMe();">
</form>
</body>
</html>
Output