This is a demo of the Politespace plugin, an accessible alternative to input mask plugins that adds whitespace formatting when you blur away from an input and removes the spaces on focus so as to not interfere with editing. Learn more about politespace on GitHub.
text
Pattern enables a numeric keyboard on some mobile platforms (iOS). Recommend using type="number" for broader numeric keyboard support.
type="number"
Text
Add the data-politespace-reverse attribute.
data-politespace-reverse
Using input[type=number] is important because it triggers the numeric keyboard on the Android browser and mobile Firefox.
input[type=number]
number
This message should be before the form element
This message should be after the form element
textarea
Strips country code (and any non-numeric characters) transparently.
tel
For integer prices, use the type="number" example below. For non-Integers, don’t use pattern="[0-9]*" or type="number", some mobile numeric keyboards do not include a ".".
pattern="[0-9]*"
For non-integer prices, use the type="text" example above.
type="text"
input[type=number] (Credit Card) with data-politespace-creditcard. Automatically customizes the grouplength attribute based on the first digit: Most are "4,4,4,4" but AMEX is "4,6,5". To automatically adjust the maxlength, add data-politespace-creditcard-maxlength as well.
data-politespace-creditcard
data-politespace-creditcard-maxlength