Add a day with selected date using Jquery datepicker -


i have been trying add day date field date selected of current field

     ,  onselect: function(date) {      var date2 = $('.currdate').datepicker('getdate');        date2.setdate(date2.getdate()+1);         $('.nextdt').datepicker('setdate', date2);     } 

however getting @ date2.setdate(date2.getdate()+1);

message: object doesn't support property or method 

how can solve issue?

it because, currdate might empty.

if currdate emtpy $('.currdate').datepicker('getdate') return null in case date2.setdate(date2.getdate()+1); throw error

update:

$(function() {     $('#nxtdate').datepicker({         dateformat: "dd-m-yy",      });     $("#currdate").datepicker({         dateformat: "dd-m-yy",          mindate:  0,         onselect: function(date){             var date2 = $('#currdate').datepicker('getdate');             date2.setdate(date2.getdate()+1);             $('#nxtdate').datepicker('setdate', date2);         }     }); }) 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -