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 simply displays back the contents of the form. It is able to do this by checking the contents of the url.myTextBox parameter (which is passed to the action page when the user submits 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.