Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何自定义jquery mobile datebox customflipbox_Jquery_Html_Jquery Mobile_Customization_Datebox - Fatal编程技术网

如何自定义jquery mobile datebox customflipbox

如何自定义jquery mobile datebox customflipbox,jquery,html,jquery-mobile,customization,datebox,Jquery,Html,Jquery Mobile,Customization,Datebox,我在北京工作。我有三个问题。首先在标题中,如何更改标题“未定义”;其次,如何更改按钮文本“外观良好”。第三,如何在输入上显示文本而不是索引 这里 代码 自定义框模式 extend(jQuery.mobile.datebox.prototype.options{ “customData”:[{ “输入”:true, “姓名”:“, ‘数据’:[‘单身’、‘分居’、‘卷入’、‘已婚’、‘丧偶’、‘情人’、‘其他’] }], “useNewStyle”:false, “overrideStyleCla

我在北京工作。我有三个问题。首先在标题中,如何更改标题“未定义”;其次,如何更改按钮文本“外观良好”。第三,如何在输入上显示文本而不是索引

这里

代码

自定义框模式
extend(jQuery.mobile.datebox.prototype.options{
“customData”:[{
“输入”:true,
“姓名”:“,
‘数据’:[‘单身’、‘分居’、‘卷入’、‘已婚’、‘丧偶’、‘情人’、‘其他’]
}],
“useNewStyle”:false,
“overrideStyleClass”:“ui图标骰子”
});
.ui图标骰子{
背景图像:url('http://dev.jtsage.com/jQM-DateBox/img/dice.png")重要,;
背景重复:无重复;
背景位置:99%50%;
}
习俗

按钮文本由
overrideCustomSet
属性修改

var selectdata = ['Single', 'Separated', 'Involved', 'Married', 'Widowed', 'Lover', 'Other'];

jQuery.extend(jQuery.mobile.datebox.prototype.options, {
    "customData": [{ "input": true, "name": "", "data": selectdata }],
     "customDefault": [0],
     "useNewStyle": true,
     "enablePopup": false,
     "centerHoriz": true,
     "centerVert": true,
     "useFocus": true,
     "useButton": false,
     "useHeader": true,
     "overrideCustomSet": "Looks Good",
     "overrideCustomFormat": "%%"   
});
对于其他两个问题,您可以处理
日期框
事件。当事件方法为
postresh
时,设置对话框标题;当方法为
set
时,从数组中按索引查找文本,并将其作为输入值

$('#cf').on('datebox', function (e, p) {
    if (p.method === 'postrefresh') {
        $(".ui-datebox-container h1.ui-title").html("My Title");
    }
    if (p.method === 'set') {
        e.stopImmediatePropagation()
        $(this).val(selectdata[p.value]);
    }
});
这是您最新的


按钮文本由
overrideCustomSet
属性修改

var selectdata = ['Single', 'Separated', 'Involved', 'Married', 'Widowed', 'Lover', 'Other'];

jQuery.extend(jQuery.mobile.datebox.prototype.options, {
    "customData": [{ "input": true, "name": "", "data": selectdata }],
     "customDefault": [0],
     "useNewStyle": true,
     "enablePopup": false,
     "centerHoriz": true,
     "centerVert": true,
     "useFocus": true,
     "useButton": false,
     "useHeader": true,
     "overrideCustomSet": "Looks Good",
     "overrideCustomFormat": "%%"   
});
对于其他两个问题,您可以处理
日期框
事件。当事件方法为
postresh
时,设置对话框标题;当方法为
set
时,从数组中按索引查找文本,并将其作为输入值

$('#cf').on('datebox', function (e, p) {
    if (p.method === 'postrefresh') {
        $(".ui-datebox-container h1.ui-title").html("My Title");
    }
    if (p.method === 'set') {
        e.stopImmediatePropagation()
        $(this).val(selectdata[p.value]);
    }
});
这是您最新的


首先,哇,我不知道有人在用这个。酷。第二,我将添加一个选项来覆盖标题-现在它要么是标签文本,要么是占位符属性。我将使其可硬编码。最后,不需要第二个函数。customFormat不支持i18n,因此您可以:“customFormat”:“%Xa”(%X1…=数值索引,%Xa…=选项文本)@J.T.Sage,感谢您开发jQM插件!我喜欢您提供了大量的灵活性和良好的文档。另外,感谢您对这个问题的评论和建议,如果您愿意,欢迎您更新我的JSFIDLE。现在您可以使用更改的格式和新的选项“customHead”——首先,哇,我不知道有人在使用它。酷。第二,我将添加一个选项来覆盖标题-现在它要么是标签文本,要么是占位符属性。我将使其可硬编码。最后,不需要第二个函数。customFormat不支持i18n,因此您可以:“customFormat”:“%Xa”(%X1…=数值索引,%Xa…=选项文本)@J.T.Sage,感谢您开发jQM插件!我喜欢您提供了大量的灵活性和良好的文档。另外,感谢您对这个问题的评论和建议,如果您愿意,欢迎您更新我的JSFIDLE。现在,您可以使用更改的格式和新选项“customHead”-