我为我的wickedpicker做了设置。这是
var options = {
now: "12:35", //hh:mm 24 hour format only, defaults to current time
twentyFour: true, //Display 24 hour format, defaults to false
upArrow: 'wickedpicker__controls__control-up', //The up arrow class selector to use, for custom CSS
downArrow: 'wickedpicker__controls__control-down', //The down arrow class selector to use, for custom CSS
close: 'wickedpicker__close', //The close class selector to use, for custom CSS
hoverState: 'hover-state', //The hover state class to use, for custom CSS
title: 'Setting Jam', //The Wickedpicker's title,
showSeconds: false, //Whether or not to show seconds,
secondsInterval: 1, //Change interval for seconds, defaults to 1 ,
minutesInterval: 1, //Change interval for minutes, defaults to 1
beforeShow: null, //A function to be called before the Wickedpicker is shown
show: null, //A function to be called when the Wickedpicker is shown
clearable: false, //Make the picker's input clearable (has clickable "x")
};
$('.time').wickedpicker(options);
然后创建一个输入字段来存储时间数据
<input id="time_field" name="time_field" class="form-control time" placeholder="Time">
保存时,进入数据库的数据格式为“hh:然后我在编辑表单中再次将其显示为一个值。
<input id="time_field" name="time_field" class="form-control time" placeholder="Time" value="{{ $post->time }}">
但是,数据没有出现,数据只显示默认数据,即12:35。
每次我编辑数据时,时间字段总是显示12:35,即使我已经根据数据库中的数据在输入中设置了值。但是,当我查看源页面时,数据库中的数据出现在值输入部分。
然后我尝试使用jquery,当我从input中检索数据值时,检索到的数据仍然是12.35,这是wickedpicker的默认数据。
var time = $('.time').val();
console.log(time) // output 12:35
也
var time = $('.time').wickedpicker('time');
console.log(time) // output 12:35
如何从数据库中设置wickedpicker上输入字段中的时间?
1条答案
按热度按时间9avjhtql1#