HTML Textbox: A Comprehensive Guide

A textbox is a common input control in HTML, but it has various hidden attributes. An HTML text box is an area on the screen wherein the user can enter the text input. It is a common input element found in many software programs, such as web browsers, email clients, and word processors. When you click on the text box, a cursor is enabled, indicating the user can begin typing. 

In this article, we will discuss the following topics:

  • What is an HTML textbox?
  • Setting a default value for textbox
  • Multiline textbox
  • Specific attributes of a textbox
  • Browser support

What is an HTML Textbox?

The HTML textbox is an input control that allows the user to enter the text input on the web page. The <input type = “text”>  is used to create a textbox.

single-line-text

output-single-line-text

Full Stack Web Developer Course

To become an expert in MEAN StackView Course
Full Stack Web Developer Course

Setting a Default Value for the Textbox

If you want to set the default value to a textbox, you can use the value attribute. Whenever the form is loaded, the default value is shown inside the textbox.

value-attribute-html-textbox

output-value

Multiline Textbox

The HTML <textarea> is a tag used within a form to declare a multiline textbox that allows the user to input text over multiple lines.

html-textarea

output-textarea

Specific Attributes of a Textbox

The HTML textbox supports the following attributes:

Attributes

Value 

Description

Autofocus

Autofocus

It specifies that the text box should automatically get focused when the page loads.

Cols

Number

It specifies the width of the text box.

Rows

Number

It specifies the height of the text box.

Wrap

Hard
soft

It specifies the text to be wrapped in a text box.

Disabled

Disabled

It specifies the width of the text box based on the number of visible characters.

Form

Form_id

It specifies one or more forms.

Maxlength

Number

It specifies the maximum number of characters in a text box.

Name

Text

It assigns the name to the text box.

Placeholder

Text

It specifies the short hint about the text box.

Browser Support

Chrome

Safari

IE 

Firefox

Opera

Android

Yes

Yes

Yes

Yes

Yes

Yes

Get skilled in HTML5 and CSS3 with the Full Stack Java Developer Master's Program. Click to check out the program details! 

Next Steps

We sincerely hope that this article on HTML textbox offered you a brief insight into how you can enter the text input on your web pages. Although this is informational, to learn more about web development in its entirety, an appropriate certification is highly recommended for jumpstarting your coding career. Simplilearn’s Full Stack Java Developer will help you master web development and help you enhance your skills. The course explores a wide range of relevant topics, that cover front-end, middleware, and back-end technologies of web development using Java. You will learn to build an end-to-end application, test and deploy code, store data using MongoDB, and much more.

If you have any questions or feedback regarding the HTML tags article, let us know in the comments section of this article. Our experts will get back to you on the same, as soon as possible.

About the Author

Aryan GuptaAryan Gupta

Aryan is a tech enthusiast who likes to stay updated about trending technologies of today. He is passionate about all things technology, a keen researcher, and writes to inspire. Aside from technology, he is an active football player and a keen enthusiast of the game.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.