asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Language References > HTML Elements > INPUT type=text Element

<input type=text> Element


Creates a single-line text entry control.HTML 2, 3.2, 4, 4.01, 5

HTML Syntax

Remarks

Use this in conjunction with the size and maxLength properties.

NOTE: Only the <input> start tag must be present. The element has no end tag.

Attributes

The <input_text> element supports the following attributes, in addition to global attributes and attributes common to all HTML input elements.

Example

The following example displays an empty text control that can contain 15 characters without scrolling.

<input type=text id="txtName" name="txtName" size=15>

The following script detects the contents of the text box and displays it in a dialog box.

<script language="JavaScript">
function detectEntry ( ) {
   alert ( "Hello " + txtName.value + ". Welcome to DHTML." );
}
</script>

The preceding HTML and script are implemented below. Click the button to call the function.

Enter your name:


See Also

INPUT   TEXTAREA


Need a break ?
Suggested Reading

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note