I use masked input on a input text field for a date in the MM/YYYY format.
( http://digitalbush.com/projects/masked-input-plugin/ )
My javascript code:
jQuery(function($){
$(".date").mask("12/2099");
});
And HTML Code:
<input type="text" class="date">
When I start to write something it take to the field the value 12/2099 and it’s impossible to write other thing.
If in javascript mask I write 99/9999, users could write date that is false … so I don’t what I have to do ?
I want to users that they could write starting on 01/1990 until 12/2099, possible adding to the restrict with the value of the date + 20 years or something like that …
Well, I think is good to have the masked input but I prefer to validate the input value cause these kind of plugins generally works with regex from inside.
My solution for this could be:
(EDITED AND TESTED)
Adding a div for a message
the js:
Hope this helps.
Regards.