本文介绍了Timepicker发送值到输入框并且悲伤30分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我从timepicker中选择值时有一个时间选择器和一个输入框我想将该值添加到输入框中,还要添加30分钟? $( #timepicker)。timepicker({更改: function (){ var getValue = $( #timepicker)。val(); var start = new 日期(getValue); var newDate = start.setTime(start.getTime()+ 30 * 60 * 1000 ); start = new 日期(newDate); { $(' #timepickerTo')。timepicker(start.getTime) ()); } }, timeFormat:' HH:mm' , minTime:' 08:00', maxTime:' 17:00', step: 30 } UPDATE ==== $( #timepicker)。timepicker({ change:function(){ var getValue = $( #timepicker)。val() ; var get = new Date(); get .setTime(getValue); var dt = new 日期(获得); var newDate = dt.setMinutes(dt.getMinutes()+ 30 * 60 * 1000 ); getValue = new 日期(newDate); $(' #timepickerTo')。val(getValue); }, var get = new Date ()获取无效日期,我的时间是08:00 解决方案 ( #timepicker)。timepicker({ change: function (){ var getValue = ( #timepicker)。val(); var start = new 日期(getValue); var newDate = start.setTime( start.getTime()+ 30 * 60 * 1000 ); start = new 日期(newDate); { (' #timepickerTo') .timepicker(start.getTime()); } }, timeFormat:' HH:mm' , minTime:' 08:00', maxTime:' 17:00', step: 30 } UPDATE ==== I have one timepicker and one input box when selecting value from timepicker i want to add that value to the input box, and add 30 minutes also?$("#timepicker").timepicker({ change:function() { var getValue = $("#timepicker").val(); var start = new Date(getValue); var newDate = start.setTime(start.getTime() + 30 * 60 * 1000); start = new Date(newDate); { $('#timepickerTo').timepicker(start.getTime()); } }, timeFormat: 'HH:mm', minTime: '08:00', maxTime: '17:00', step: "30" }UPDATE====$("#timepicker").timepicker({ change:function() { var getValue = $("#timepicker").val(); var get = new Date(); get.setTime(getValue); var dt = new Date(get); var newDate = dt.setMinutes(dt.getMinutes() + 30 * 60 * 1000); getValue = new Date(newDate); $('#timepickerTo').val(getValue); },var get= new Date() gets invalid date, my time is 08:00 解决方案 ("#timepicker").timepicker({ change:function() { var getValue =("#timepicker").val(); var start = new Date(getValue); var newDate = start.setTime(start.getTime() + 30 * 60 * 1000); start = new Date(newDate); {('#timepickerTo').timepicker(start.getTime()); } }, timeFormat: 'HH:mm', minTime: '08:00', maxTime: '17:00', step: "30" }UPDATE==== 这篇关于Timepicker发送值到输入框并且悲伤30分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-22 18:30