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


Picture showing the output of document.getElementByID in JavaScript



Posted By  -  Karan Gupta
 
Posted On  -  Friday, December 31, 2010

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250