The HTML | dirname Attribute is used to enable the text direction of the input and the Textarea Field after submitting the form. The value of the dirname attribute must be the name of the input field and textarea, followed by “.dir”.
it can be used with both of the <input> and <textarea> element.
- Dirname attribute in <input> Element:
Syntax:<input name="myname" dirname="myname.dir">
Example-1: This Example illustrates the use of dirname attribute in Input Element.
<!DOCTYPE html><html><head><style>h1 {color: green;}</style></head><body><formaction="/action_page.php"><h1>GeeksforGeeks</h1><h2>HTML | dirname attribute</h2> First name:<inputtype="text"name="fname"dirname="fname.dir"><inputtype="submit"value="Submit"></form><p>After the Submission of the form,the text direction of the inputfield will also be submitted.</p></body></html>chevron_rightfilter_noneOutput:

- dirname attribute in <textarea> Element:
Syntax:<textarea name="myname" dirname="myname.dir"></textarea>
Example-2: This Example illustrates the use of dirname attribute in the Textarea element.
<!DOCTYPE html><html><head><style>h1 {color: green;}</style></head><body><formaction="/action_page.php"><h1>GeeksforGeeks</h1><h2>HTML | dirname attribute</h2><textareaname="Geeks"dirname="geeks.dir"placeholder="write something here"></textarea><inputtype="submit"value="Submit"></form><p>After the Submission of the form, the textdirection of the Textarea field will also,be submitted.</p></body></html>chevron_rightfilter_noneOutput:

Supported Browsers: The browser supported by dirname attribute are listed below :
- Google Chrome
- Opera
- Safari
Recommended Posts:
- HTML | <input> dirname Attribute
- HTML | <textarea> dirname Attribute
- HTML | <textarea> dirname Attribute
- PHP | dirname( ) Function
- Node.js | path.dirname() Method
- HTML | <html> xmlns Attribute
- HTML | scoped Attribute
- HTML | <th> valign Attribute
- HTML | <col> align Attribute
- HTML | poster Attribute
- HTML | Class Attribute
- HTML | style attribute
- HTML | <area> target Attribute
- HTML | oninvalid Event Attribute
- HTML | <select> autocomplete Attribute
- HTML & CSS | Tabindex attribute & Navigation bars
- HTML | <table> bgcolor Attribute
- HTML | onsubmit Event Attribute
- HTML | onunload Event Attribute
- HTML | srcdoc Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


