HTML dirname Attribute

❮ HTML Attributes


<form action="action.php">
	<label for="fname">First name:</label>
	<input type="text" id="fname" name="fname" dirname="fname.dir"><br><br>
	<label for="lname">Last name:</label>
	<input type="text" id="lname" name="lname"><br><br>
	<input type="submit" value="Submit">


The dirname attribute is valid for text and search input types only, the dirname attribute enables the submission of the directionality of the element.

The dirname attribute specifies the submission of the text direction of the text area and the value is always the name of the text area (suffix ".dir").

Standard Syntax

HTML: <element dirname="inputname.dir">

Browser Support


Applies to:

The dirname attribute can be used on the following element:

Element Attribute
<input> dirname
<textarea> dirname

Attribute Values

Value Description
inputname.dir The text direction of the input field will be submitted.
❮ HTML Attributes