• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2<html>
3<head>
4<title>Number type input shows and accepts localized numbers</title>
5<style>
6:invalid {
7  border-color: red;
8  -webkit-box-shadow: 4px 4px 8px #ff8888;
9}
10</style>
11</head>
12<body>
13<div id="console"></div>
14
15<p>Output test: The following text field should have a localized representation for "-1234.5678".
16e.g. "-1,234.5678" for en_US locale, "-1.234,5678" for fr_FR locale.</p>
17<div><input type=number value="-1234.5678" step=any></div>
18
19<p>Input test: Type a localized representation of a number into the following text field.
20You'll see an equivalent number in the standard format on the bottom of the text field.</p>
21<div><input type=number id=target step=any oninput="handleInput()"></div>
22<div>Standard format: <output id=output></output></div>
23
24<script>
25function handleInput() {
26  document.getElementById('output').value = document.getElementById('target').value;
27}
28</script>
29</body>
30</html>
31