This page is Not Ready

Notice: The WebPlatform project has been discontinued when the Stewards partnership agreement ended in September 2015. This site has been frozen, and the assets we have created will remain.



The input element with a type attribute whose value is “text” represents a one-line plain text edit control for the input element’s value.

Overview Table

DOM Interface


This example uses the INPUT type=text element to create an empty text control that can contain 15 characters without requiring the user to scroll to read all of the text.

<INPUT TYPE=text VALUE="" NAME="textbox" SIZE=15>

This example uses script to detect the content of the text box and display it in a dialog box.

function detectEntry()
    alert("Your name is " + textbox.value)



The SIZE attribute sets the number of visible characters in the INPUT type=text element. The MAXLENGTH attribute sets the maximum number of characters that can be entered. **Security Warning: **Using this object incorrectly can compromise the security of your application. When submitting text through INPUT type=text over an intranet or the Internet, validating the text string is recommended. For instance, you might validate the string for a restricted set of known, good values (such as letters and numbers) and ignore the rest. You should review the Security Considerations: Dynamic HTML before continuing. Note For more code samples, see Form controls part 1 and Form controls part 2: validation on the Windows Internet Explorer sample site.

Standards information

HTML information


See also

External resources

Related pages