且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Jquery Mobile Datepicker 在滑动时更改月份

更新时间:2022-12-19 18:11:06

使用getDate方法获取日期,添加月份然后使用setDate设置设置新日期的方法.

use the getDate method to get the date, add a month and then set the using the setDate method to set the new date.

这是向右滑动的示例:

 var thedate=$(".date-input-inline").datepicker('getDate'); //get date from datepicker
 thedate.setMonth(thedate.getMonth()+1); //add a month 
 $(".date-input-inline").datepicker('setDate',thedate); // set the date in datepicker

向左滑动会有相同类型的代码,你只需要减去一个月.

swipe left would have same type of code, you just need to subtract a month.