开发者

Datepicker onSelect not working

开发者 https://www.devze.com 2023-03-04 00:27 出处:网络
I have the function below that doesn\'t seem to work and could do with a little help please. The function basically adds 30 days to the date selected with the datepicker.

I have the function below that doesn't seem to work and could do with a little help please. The function basically adds 30 days to the date selected with the datepicker.

$('#datepicker').datepicker({
   onSelect: function(dateText, inst) { 

       var date = new Date(dateText);
       date.setDate(date.getDate() + 30);
       date.format('mm/dd/yy');

       alert(date)
   }
});

I cant see where I am going wrong. When a date is selected 开发者_JAVA百科it is adding a empty anchor to the address bar URL, if is helps.

Thanks.


The problem is that date.format('mm/dd/yyy') is blowing up.

Examples of how to format a date in js here:

http://www.webdevelopersnotes.com/tips/html/10_ways_to_format_time_and_date_using_javascript.php3

0

精彩评论

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