0

In HTML5, we can mention lang of input.

Currently I have one input type=number field. If browser language is set to German then its allowing ',' (comma) but if browser language is set to English then it wont allow comma.

So I added lang attribute for html tag only, but its not allowing comma.

I have created jsbin for same.

HTML:

<!DOCTYPE html>
<html lang='de-AT' xml:lang="de-AT">
<head>
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
   <input type="number">
</body>
</html>

What is best way to set language as German (de-AT) for input ?

Nitish
  • 651
  • 1
  • 7
  • 14

1 Answers1

1

Comma should be allowed in firefox, but for chrome it's a bit tricky, you need to use <type=text> and validate if the input is a number or not manually using javascript. This question was already asked here, see it for details.

Vaibhav Vishal
  • 6,576
  • 7
  • 27
  • 48