HTML - attributes - dirname

revision:


Content

"dirname" attribute : enables submission of text direction syntax some examples


"dirname" attribute : enables submission of text direction

top

The dirname attribute enables the submission of the text direction of the input field/textarea. The "dirname" attribute can be used on the <input> and <textarea> elements.
The dirname attribute on an input element submits the element's text direction, left-to-right or right-to-left, together with the input value.


syntax

top

<element name=”myname” dirname=”myname.dir”></element>

The dirname attribute's value is always the name of the input field/textarea, followed by ".dir". It specifies that the text direction of the input field will be submitted.


some examples

top
Text:

When the form is being submitted, the text direction of the textarea will also be submitted.

codes
                    <form style="margin-left:5vw;" action="action_page.php">
                        Text:<br>
                        <textarea name="explanation"dirname="explanation.dir"></textarea>
                        <input type="submit" value="Submit">
                    </form>
                

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

codes
                    <form  style="margin-left:5vw;" 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>