coderef

dirnameBaseline · Widely available

The dirname attribute of <textarea> and <input> HTML elements includes the field's writing direction as form data on submission.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Aug 1, 2023. Widely available since Feb 1, 2026.

Browser support

DesktopChrome
1–16Not supported
17+Supportedsince Feb 8, 2012
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–115Not supported
116+Supportedsince Aug 1, 2023
Current: 157
Safari
1–5.1Not supported
6+Supportedsince Jul 25, 2012
Current: 27
MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155
Firefox Android
4–115Not supported
116+Supportedsince Aug 1, 2023
Current: 157
Safari iOS
1–5Not supported
6+Supportedsince Sep 10, 2012
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: dirName.

Feature detection

JS · check before using
if ("HTMLInputElement" in globalThis && "dirName" in HTMLInputElement.prototype) {
  // HTMLInputElement.dirName is available
}

Sub-features

Support for each part of the feature (4). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
HTMLInputElement.dirName17791166181166
HTMLTextAreaElement.dirName17791166181166
input.dirname17791166181166
textarea.dirname17791166181166