jQuery datepicker for date of birth

Just configured a JQuery datepicker for taking date of birth input. It will show you 100 years to current date. You can’t select date beyond the yesterday date (present date is excluded). You can configure it more according to your needs. But if you just want a simple datepicker, it will work for you.

$(function() {
        $( "#datepicker" ).datepicker({
            dateFormat : 'mm/dd/yy',
            changeMonth : true,
            changeYear : true,
            yearRange: '-100y:c+nn',
            maxDate: '-1d'
        });
    });

See demo.

You can apply stylesheet of JQuery, on demo you will see calendar with no styles.

Related Posts Plugin for WordPress, Blogger...
  • KAsh

    Very Good work.

  • http://www.pakzilla.com Tahir Akram

    Thanks Kash :) for dropping by.

  • Philipp Rieber

    Why is the year range using the letters “y” and “nn”, I don’t thinks these are valid options following http://api.jqueryui.com/datepicker/#option-yearRange.

    I think it should read:
    … yearRange: ‘-100:c’ …
    to show the last 100 years.

    c = current year
    nnnn = placeholder for absolute year
    +nn or -nn = relative to today’s year
    c+nn or c-nn = relative to currently selected year

  • Kim

    sweet :) exactly what I needed thx!!