Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/19.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
Javascript JQuery Mobile自定义Flipbox获取选定值_Javascript_Jquery Mobile_Datebox - Fatal编程技术网

Javascript JQuery Mobile自定义Flipbox获取选定值

Javascript JQuery Mobile自定义Flipbox获取选定值,javascript,jquery-mobile,datebox,Javascript,Jquery Mobile,Datebox,我使用Datebox jQM插件创建了以下customflipbox: <div data-role="fieldcontain"> <label for="cf" data-i18n="config.localelabel"></label> <input name="cf" type="date" data-role="datebox" id="cf" data-options='{"mode": "customflip

我使用Datebox jQM插件创建了以下customflipbox:

<div data-role="fieldcontain">
    <label for="cf" data-i18n="config.localelabel"></label>
    <input name="cf" type="date" data-role="datebox" id="cf" data-options='{"mode":        "customflip",
"customData": [  {
"input": true,
"name": "",
"data": ["Italiano","English","Espanol","Deutsch","Francais","русский"]
}],
"useNewStyle": false,
"overrideStyleClass": "ui-icon-dice",
"useButton":false,
"useFocus" : true
}' />
在“datebox”事件上,但似乎我能得到的最多信息是,该字段填充了所选值的索引,但我需要实际字符串(例如英语)

有什么见解吗

多谢各位。
M.

在代码中添加数据数组,然后您可以在“设置”事件中引用它:

<div data-role="fieldcontain">
    <label for="cf" data-i18n="config.localelabel"></label>
    <input name="cf" type="date" data-role="datebox" id="cf" data-options='{"mode":        "customflip",
"useNewStyle": false,
"overrideStyleClass": "ui-icon-dice",
"useButton":false,
"useFocus" : true
}' />


$(“#cf”)
您错过了散列。哦,是的,我的错,只是在发布问题时输入了一个错误,原始代码是正确的:)。谢谢你,谢谢你,@ezanker。您的解决方案非常好:),我想我需要学习更多的jQuery技能:)。
<div data-role="fieldcontain">
    <label for="cf" data-i18n="config.localelabel"></label>
    <input name="cf" type="date" data-role="datebox" id="cf" data-options='{"mode":        "customflip",
"useNewStyle": false,
"overrideStyleClass": "ui-icon-dice",
"useButton":false,
"useFocus" : true
}' />
var selectdata = ["Italiano","English","Espanol","Deutsch","Francais","русский"];
jQuery.extend(jQuery.mobile.datebox.prototype.options, {
    'customData': [{
        'input': true,
            'name': '',
            'data': selectdata
    }],
        "useHeader": false,
        "overrideCustomSet": "OK"
});

$('#cf').on('datebox', function (e, p) {
    if (p.method === 'set') {
        e.stopImmediatePropagation();
        $(this).val(selectdata[p.value]);
    }
});