Using setDate with jQueryUi datepicker

后端 未结 1 720
盖世英雄少女心
盖世英雄少女心 2021-02-14 04:30

I\'m trying to set the date of another datepicker exactly 1 year on from the original datepicker on close.

I have the following code:

$(\"#myDatepicker1\         


        
相关标签:
1条回答
  • 2021-02-14 04:52

    You can try something like that:

    d = $("#myDatepicker1").datepicker("getDate");
    $("#myDatepicker2").datepicker("setDate", new Date(d.getFullYear()+1,d.getMonth(),d.getDate()));
    

    EDIT:

    This is the solution to add one year, just to make sure that this is the piece which was missing right?! the on close it`s working fine right?!

    0 讨论(0)
提交回复
热议问题