Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

HTML <textarea> dirname Attribute

The dirname attribute on a <textarea> tag submits the direction, together with the textarea value.

Direction values can be ltr (left-to-right) or rtl (right-to-left).

Example

#

A <textarea> element with a dirname attribute.
Submitting this form will send the textarea value and its direction.



<form action="/tutorial/action.html">
  <label for="message">Message:</label><br />
  <textarea id="message" name="message" 
            dirname="message.dir" cols="50"></textarea><br/>

  <input type="submit" value="Submit">
</form>

Using dirname

The name of this attribute must be the textarea name followed by .dir.

This attribute helps in identifying the correct direction for the textarea's text.

Here is a list of the languages that are written from right-to-left (rtl):

  • Arabic
  • Aramaic
  • Azeri
  • Dhivehi/Maldivian
  • Hebrew
  • Kurdish (Sorani)
  • Persian/Farsi
  • Urdu

Syntax

<textarea name="text" dirname="textarea_name.dir">

Values

#

Value Description
textarea_name.dir Submits the text direction of the textarea value.
Possible values are ltr (left-to-right) or rtl (right-to-left).

Browser support

Here is when dirname support started for each browser:

Chrome
1.0 Sep 2008
Firefox
Not Supported
IE/Edge
79.0 Jan 2020
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <textarea>
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

Guides