简体   繁体   中英

Disable past dates in datepicker js

I want to disable all the dates in calendar which is lesser than today. I tried adding $("#ctl00_MainContent_tbxLetterDate").datepicker({ minDate: +0 }); But it dosent work, Here is my code..

$("#ctl00_MainContent_tbxLetterDate").datepicker({ changeYear: true, dateFormat: 'dd/mm/yy', showOn: 'none', showButtonPanel: true });
    $("#ctl00_MainContent_tbxLetterDate").attr('readOnly', 'true');
    $("#ctl00_MainContent_tbxLetterDate").datepicker({ minDate: +0 }); 
    $("#ctl00_MainContent_imgLetterDate").live("click", function () {
        $("#ctl00_MainContent_tbxLetterDate").datepicker('show'); return false;
    });

Try it like this, with string value

 minDate:'0d'

$("#ctl00_MainContent_tbxLetterDate").datepicker({ changeYear: true, dateFormat: 'dd/mm/yy', showOn: 'none', showButtonPanel: true,  minDate:'0d' });

And check it after

alert( $("#ctl00_MainContent_tbxLetterDate").datepicker( "option", "minDate" ));

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