Dofactory.com
Dofactory.com

HTML <input> lang Attribute

The lang attribute on an <input> tag specifies the language of that control.

Its value is used for site accessibility, translations, and SEO purposes.

Example

#

A lang attribute on an <input> element.
This input field uses a different language.



<form action="/tutorial/action.html">
  <input type="text" lang="ko" value="아라 윤"
         name="name" ><br /><br />

  <input type="submit">
</form>

Using lang

The lang attribute specifies the language used in the input element.

The first two characters of the lang value refers to the language code.

The last two characters - which are optional - refer to the country code.


Syntax

<input lang="language-code-country-code">

Values

#

Value Description
language-code-country-code The first 2 characters represent the language code of the page.
The last two characters represent the country code (optional).

Browser support

Here is when lang support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <input>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


What's your favorite/least favorite part of Dofactory?


Guides