Birthday input field - auto-adding dots after specific amount of characters
Hey guys, unusual question: I have a input field #birthday that should accept european date 开发者_高级运维format like this. dd.MM.yyyy
I wonder if it is possible to auto apply dots when typed into this field.
Imagine the inputfield is focused and empty. I start typing to numbers and the field autogenerates a dot, again two numbers and a dot is generated.
My aim is to type only numbers without needing to add the dots.
any idea how i could achieve that with jquery or javascript in general?
$('#birhtday').keypress(function() {
// ?
})
Why not use existing jQuery plugins?
- Masked input
- meioMask - I find it nicer because it doesn't use those underscores (but it seems to have some bugs when TABing through filled form)
精彩评论