Created
September 26, 2012 05:00
-
-
Save aaronsnoswell/3786176 to your computer and use it in GitHub Desktop.
Android Webkit <input type="number" /> shim.
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
// jQuery version | |
$("input[type='number']").each(function(i, el) { | |
el.type = "text"; | |
el.onfocus = function(){this.type="number";}; | |
el.onblur = function(){this.type="text";}; | |
}); | |
// Stand-alone version | |
(function(){ var elms = document.querySelectorAll("input"), i=elms.length; | |
while(i--) { | |
var el=elms[i]; if(el.type=="number"]) | |
el.type="text", | |
el.onfocus = function(){this.type="number";}, | |
el.onblur = function(){this.type="text";}; | |
} | |
})(); |
Hello. How I use this function in the input mask with numeric?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍