开发者

jquery datepicker: alert when certain days are clicked on the jquery datepicker

i have a certain dates that come from database and want to block those dates from s开发者_如何学编程electing, how would i do that? like Alert when certain days are clicked on the jquery datepicker?

i am using asp.net C#. and pass the dates from server side to client?

any help?


I think you would have to use the onSelect event of the datepicker to do this.

Per Jquery Documentation:

$('.selector').datepicker({
   onSelect: function(dateText, inst) { //check for date and show alert }
});

HTH


var disabledDates = ['04/30/2010', '05/01/2010'];

$(function(){

$('#datepicker').datepicker({ 

    dateFormat: 'dd/mm/yy', 
    beforeShowDay: editDays 
}); 

function editDays(date) { 
    for (var i = 0; i < disabledDates.length; i++) { 
        if (new Date(disabledDates[i]).toString() == date.toString()) {              
             return [false]; 
        } 
    } 
    return [true]; 
 }    

});

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜