I’d like to attach the jQueryUI datepicker control so users can pick their date of birth.
Here is my Javascript code:
<script type="text/javascript">
$(document).ready(function() {
$("#dob").datepicker({
minDate: "-100Y",
maxDate: "+1M +10D",
changeMonth: true,
changeYear: true
});
});
</script>
So I want users to be able to select a date, that’s either 100 years earlier or a month from now. (Although it would be better if I could limit the max range to be a year before “today”)
What is wrong with my jQuery options, it just doesn’t seem to listen to what I want.
It’s displaying the years from 2002 to 2012.
It is listening to what you want. I tested your source in jsFiddle, and it runs fine.
The “Year” dropdown will only display 10 items at a time by default. You can change this with the
yearRangeoption (e.g.,yearRange: 'c-100:c+10',).