Horje
HTML dirname Attribute

Definition and Usage

The dirname attribute enables the submission of the text direction of the input field/textarea

The dirname attribute's value is always the name of the input field/textarea, followed by ".dir".


Applies to

The dirname attribute can be used on the following elements:

Elements Attribute
<input> dirname
<textarea> dirname

Browser Support

The dirname attribute has the following browser support for each element.


How to add An HTML form where the field's text direction will be submitted

Input Example
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The dirname attribute</h1>

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

<p>When the form is being submitted, the text direction of the input field will also be submitted.</p>

</body>
</html>

Output should be:

How to add An HTML form where the field's text direction will be submitted

How to add An HTML form where the field's text direction will be submitted

Textarea Example.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The textarea dirname attribute</h1>

<form action="/action_page.php">
  Text:<br>
  <textarea name="explanation"dirname="explanation.dir"></textarea>
  <input type="submit" value="Submit">
</form>

<p>When the form is being submitted, the text direction of the textarea will also be submitted.</p>

</body>
</html>

Output should be:

How to add An HTML form where the field's text direction will be submitted




html dirname attribute

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference