简体   繁体   中英

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');
    });

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"

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM