name
The attribute name will represents the name of the control, in JavaScript we can find the control by it's name also.
Syntax:
<input type="text" name="textboxname" />
Example:
<html>
<head>
<title>HTML Tutorial</title>
<script language="javascript">
function ShowInput() {
var input = document.getElementsByName("txtinput");
if (input.length > 0)
alert(input[0].value);
}
</script>
</head>
<body>
Enter input :
<input type="text" name="txtinput" />
<input type="button" name="btnShow" onclick="ShowInput();" value="Show entered input" />
</body>
</html>
Output:
Useful Tools
Online Code Editor and Compiler
HTML Minifier
Online HTML Compiler/Preivew
Word Count Tool
Replace Text/Word tool
Latest Blogs
How to check if a canvas is empty or blank
Maintain div or panel scroll position after postback in asp.net update panel
Draggable button using jquery ui
Get total number of tables, views, stored procedures and functions count and names in sql server
JavaScript function to get date in mmddyyyy hhmmss ampm forma