Created
April 26, 2011 00:35
-
-
Save turadg/941550 to your computer and use it in GitHub Desktop.
Shim for HTML5 number input type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Requires: | |
* Modernizr <http://www.modernizr.com/> | |
* JQuery Numeric <http://www.texotela.co.uk/code/jquery/numeric/> | |
*/ | |
// require numeric input even when HTML5 not available | |
if (!Modernizr.inputtypes.number) { | |
// no native support for <input type="number"> | |
$("input[type=number]").numeric(false, function() { alert("Integers only"); this.value = ""; this.focus(); }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Requires: | |
* Modernizr <http://www.modernizr.com/> | |
* JQuery Numeric <http://www.texotela.co.uk/code/jquery/numeric/> | |
*/ | |
// require numeric input even when HTML5 not available | |
if (!Modernizr.inputtypes.number) { | |
// no native support for <input type="number"> | |
$("input[type=number]").numeric(false, function() { alert("Integers only"); this.value = ""; this.focus(); }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment