kapil
kapil

Reputation: 483

JQuery date picker function isn't working

i'm using this jquery date picker function, it works fine if i remove "year range:1930" from it, but doesn't work if i include year range. i dont know how to deal with this problem. help me.

<script type="text/javascript">
jQuery(function ($) {
    $('input[name="dob1"]').datepicker({
        "dateFormat": "mm/dd/yy",
            "firstDay": "1",
            "changeMonth": true,
            "changeYear": true,
            "yearRange": "1930"
    }).datepicker('option', 'onSelect', function () {
        $(this).removeClass('watermark');
    });

Upvotes: 5

Views: 417

Answers (2)

Mike Ramsey
Mike Ramsey

Reputation: 843

Change your "yearRange": "1930" to "yearRange": "1930:+0"

or if you want it to start at 1930 and go forever set it to "1930:9999"

Upvotes: 1

iambriansreed
iambriansreed

Reputation: 22241

The documentation (http://api.jqueryui.com/datepicker/#option-yearRange) states:

The range of years displayed in the year drop-down: either relative to today's year ("-nn:+nn"), relative to the currently selected year ("c-nn:c+nn"), absolute ("nnnn:nnnn"), or combinations of these formats ("nnnn:-nn").

Note that this option only affects what appears in the drop-down, to restrict which dates may be selected use the minDate and/or maxDate options.

Change:

"yearRange": "1930"

To:

"yearRange": "1930:1930"

Upvotes: 1

Related Questions