Created
July 18, 2018 08:53
-
-
Save ifirmawan/da54e05081cff0aaf045a0d7a55a83a4 to your computer and use it in GitHub Desktop.
input auto set format medium date
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
$("input[name='birthdate']:first").keyup(function(e){ | |
var key=String.fromCharCode(e.keyCode); | |
if(!(key>=0&&key<=9))$(this).val($(this).val().substr(0,$(this).val().length-1)); | |
var value=$(this).val(); | |
if(value.length==2||value.length==5)$(this).val($(this).val()+'/'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment