0

I am trying to dynamically set the locale by setting "lang" attribute of html :

$(document).ready(function () {
   $("html").attr("lang","ko-KR");// or "en-us"
 });

The below code does not work :

<input id="date" type="date"> . 

The date format works when I set the locale in html page but doesn't work when I dynamically set it through jquery. However if I directly set in the html page it works :

<html lang="ko-KR">

Let me know where I am going wrong. Thanks in advance.

3
  • 1
    You may need to reload the page after setting it Commented Jan 31, 2018 at 8:22
  • And working/not working means what exactly …? Commented Jan 31, 2018 at 8:26
  • <input id="date" type="date"> . The date format works when I set locale in html page but doesnot work when I dynamically set it through jquery. Commented Jan 31, 2018 at 8:30

1 Answer 1

1

Read this article: https://www.w3.org/International/questions/qa-html-language-declarations.

If you want to create metadata that describes the language of the intended audience of a page, rather than the language of a specific range of text, do so by getting the server to send the information in the HTTP Content-Language header. If your intended audience speaks more than one language, the HTTP header allows you to use a comma-separated list of languages.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.