我想实现一个清晰的按钮显示在移动滚动日期选择器弹出有一个使用button3的选项,但我不能清除输入和隐藏滚动条。
jQuery(this).mobiscroll({
preset: 'date',
theme:'ios',
button3Text:'clear',
button3: function(input, inst){
jQuery(this).val();
inst.close();
}})我尝试使用函数中的input和inst参数。不幸的是,我不能让它工作。
你能帮帮忙吗?
谢谢卢卡斯
发布于 2013-04-29 18:32:21
我已经解决了这个问题。我无法获取实例,但当我首先保存对象时
var thisPicker = jQuery(this); 在button3上获取实例,
var inst = thisPicker.mobiscroll('getInst');一切都很好。
完整的代码。
// Date mobiscroll picker init
jQuery(".datepicker").each(function (index, element) {
var thisPicker = jQuery(this);
jQuery(this).mobiscroll({
preset: 'date',
theme:'ios',
display : 'bottom',
button3Text:'X',
button3: function(){
var inst = thisPicker.mobiscroll('getInst');
thisPicker.val('');
inst.cancel();
},
});
});发布于 2013-12-19 22:46:30
我刚刚发现在mobiscroll config中有一个启用“清除”按钮的选项:
http://docs.mobiscroll.com/2-15-1/mobiscroll-core#!opt-buttons
显示的
按钮。预定义按钮有:'set','clear',‘cancel’。也可以指定自定义按钮:
https://stackoverflow.com/questions/16231755
复制相似问题