Automatic Date Completion

联合创作 · 2023-10-02 16:19

For use in an <input type="text" /> field. It lets the user only type in 10 and the input will be transformed into 2007-12-10.

Only typing a number will get the month and year. It presumes it's in the future, so if you type 10 on the eleventh of November, it will return December (2007-12-10 that is).

Works great with the jQuery UI Datepicker

One way of use

$("input").blur(function () {
var value = $(this).val();

$(this).dateCompletion(value);
}
});
浏览 8
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报