Skip to content

Instantly share code, notes, and snippets.

Nicolas Bouvrette nbouvrette

  • Montreal
Block or report user

Report or block nbouvrette

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nbouvrette
nbouvrette / inputTypeNumberPolyfill.js
Last active Apr 18, 2019
Stand alone JavaScript polyfill allow only numbers on input of type number.
View inputTypeNumberPolyfill.js
/**
* Stand alone polyfill allow only numbers on input of type number.
*
* While input filtering is already supported by default by some browsers, maximum length has not been implemented by
* any. This script will solve both issue and make sure that only digits can be entered in input elements of type
* number. If the optional attribute `max` is set, it will calculate it's length and mimic the `maxlength` behavior on
* input of type text.
*
* Supports:
*
You can’t perform that action at this time.