Politely add spaces to numeric form values to increase readability (credit card numbers, phone numbers, etc).
All data
attributes are now prefixed with data-politespace-
. They will need to be updated to work correctly. Changes include:
data-politespace-grouplength
data-politespace-delimiter
data-politespace-reverse
data-politespace-decimal-mark
Auto-initialization code has been moved into a separate file, to make it optional. If you want the component to scan the DOM for politespace inputs and initialize them automatically, include the politespace-init.js
file. Optionally, you can call $("[data-politespace]").politespace();
manually.
<input type="number">
fields.maxlength
inconsistencies with formatted values.Adds support for input type="number"
and data-delimiter
.
input type="number"
is important to trigger numeric keyboards on Android and Mobile Firefox.data-delimiter
allows you to use a different character instead of a space.data-reverse
attribute to apply grouplengths from right to left (useful for money fields, where "$1234"
shouldn’t transform to "$1,234"
.Fixes bug with removal of spaces on focus.
This is the initial release.