| <!doctype html>
<meta charset="utf-8"/>
<title><input type="number"> localization test</title>
<style>* { font-size: 16px; } label { display: block; }</style>
<h1>Test of decimal mark support for comma and periods in
<input type="number"></h1>
<ol>
<li>Start by reading this <a
href="https://www.ctrl.blog/entry/html5-input-number-localization"
>blog post</a></li>
<li>Set the user interface language of the browser or operating system
to English (reboot may be required)</li>
<li>Fill in <samp>4.5</samp> (period!) in each of the fields. After
clicking/tapping outside the field, a dialog should display 4.5.</li>
<li>Repeat the third step, but fill in <samp>4,5</samp> (comma!)
instead</li>
<li>Set the user interface language to Norwegian (norsk bokmål) (reboot
may be required)</li>
<li>Repeat the third and forth steps</li>
</ol>
<label>
English (period)
<input type="number" lang="en" step="0.01" id="input-en" />
</label>
<label>
Norwegian (comma)
<input type="number" lang="nb" step="0.01" id="input-nb" />
</label>
<label>
Undefined locale
<input type="number" step="0.01" id="input-undefined" />
</label>
<script>
document.getElementById('input-en').addEventListener(
'blur', displayInputValue);
document.getElementById('input-nb').addEventListener(
'blur', displayInputValue);
document.getElementById('input-undefined').addEventListener(
'blur', displayInputValue);
function displayInputValue(event) {
alert(event.target.value);
}
</script>
|