HTML Textbox

This page contains HTML textbox code. This code can be copy/pasted into your own website or blog.

In HTML, you create a textbox by using the <textarea> element. This element creates a multiline text input field (i.e. one that spans over multiple lines).

Basic TextBox Example

Here's an example of an HTML textbox:

Source CodeResult

Textbox Size

You can specify how many columns and how many rows should be visible without the need to scroll. To do this, you need to use the cols and rows attributes.

Source CodeResult

Textbox Name

The <textarea> element also accepts a name attribute. This name can be referred to within any script that processes the contents of the textbox.

Source CodeResult

Submitting Your Textbox

In HTML, textboxes are usually displayed as one of many elements within a form. HTML forms usually have a "Submit" button (along with type="submit"). When the user clicks the "Submit" button, the form is submitted to its "action" page (which is specified using the action attribute). It's this "action" page that is responsible for processing the contents of the form.

In our example below, the "action" page is a simple thankyou page. In practice, it would process the data sent by the form.

Source CodeResult


More

You can also change the textbox color and create a textbox border.

Check out this article with more textarea codes that you can copy/paste into your website or blog.