gpt4 book ai didi

javascript - Mobiscroll onBeforeShow,设置值

转载 作者:行者123 更新时间:2023-12-02 19:06:05 26 4
gpt4 key购买 nike

如何使用 mobiscroll 调用 onBeforeShow 事件?

$('#starttime').mobiscroll('setValue', value).time({
theme: 'jqm',
display: 'modal',
mode: 'clickpick',
stepMinute: 10,
onBeforeShow:
});

我需要在它显示之前设置时间。如果我尝试在文档准备好时执行此操作,则输入字段尚未准备好值...

编辑

我尝试过:

$('#starttime').mobiscroll('setValue', value).time({
theme: 'jqm',
display: 'modal',
mode: 'clickpick',
stepMinute: 10,
onBeforeShow: function(html, inst) {
start = $('#starttime').val();
var a = moment();
var value = a.format('h:mm A');

}
});

但随后我收到错误:“值未定义”...

最佳答案

您必须提供回调函数。

$('#starttime').mobiscroll('setValue', value).time({
theme: 'jqm',
display: 'modal',
mode: 'clickpick',
stepMinute: 10,
onBeforeShow: function (html, inst) {
//Gets called before the scroller appears. The function receives the jQuery object containing the generated html and the scroller instance as parameters
}
});

http://docs.mobiscroll.com/23/mobiscroll-core

关于javascript - Mobiscroll onBeforeShow,设置值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14289475/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com