Javascript 将下拉列表设置为jQuery自定义选择菜单
我正在尝试将下拉列表设置为jQuery Mobile自定义选择菜单: 下面是它要说的: 要在特定选择上使用自定义菜单,只需添加 数据本机菜单=假属性。或者,这也可以 以编程方式设置选择菜单的nativeMenu配置选项 在绑定到mobileinit事件的回调中设置为false,以实现 同样的效果。这将使所有选择全局使用自定义菜单 默认情况下。在创建jQuery之后,页面中必须包含以下内容 已加载,但在加载jQuery Mobile之前 因此,我首先尝试将其添加到我的服务器控件:Javascript 将下拉列表设置为jQuery自定义选择菜单,javascript,jquery,html,asp.net,jquery-mobile,Javascript,Jquery,Html,Asp.net,Jquery Mobile,我正在尝试将下拉列表设置为jQuery Mobile自定义选择菜单: 下面是它要说的: 要在特定选择上使用自定义菜单,只需添加 数据本机菜单=假属性。或者,这也可以 以编程方式设置选择菜单的nativeMenu配置选项 在绑定到mobileinit事件的回调中设置为false,以实现 同样的效果。这将使所有选择全局使用自定义菜单 默认情况下。在创建jQuery之后,页面中必须包含以下内容 已加载,但在加载jQuery Mobile之前 因此,我首先尝试将其添加到我的服务器控件: <asp:
<asp:DropDownList runat="server" ID="ddlLocJobPhOpt" data-mini="true" data-native-menu="false"></asp:DropDownList>
我似乎正在渲染,就像下面的示例一样:
<select name="ddlLocJobPhOpt" id="ddlLocJobPhOpt" data-mini="true" data-native-menu="false">
<option value="Select" data-theme="a">Select</option>
<option value="100101" data-theme="a">100101</option>
</select>
接下来,我尝试在jQuery和jQuery mobile加载之间添加jQuery:
<script type="text/javascript" src="Scripts/jquery-2.0.3.min.js"> </script>
<script>
$(document).on("mobileinit", function () {
$.mobile.selectmenu.prototype.options.nativeMenu = false;
});
</script>
<script src="Scripts/CustomScripts/jquery.mobile-1.4.1.js"></script>
他们俩都没有做任何事。我做错了什么?当您单击selectmenu时,它看起来像什么?像一个标准的下拉菜单。确保触发mobileinit事件。请尝试$document.onpagebeforecreate,函数{$select.selectmenu{nativeMenu:false};};。
<script type="text/javascript" src="Scripts/jquery-2.0.3.min.js"> </script>
<script>
$(document).on("mobileinit", function () {
$.mobile.selectmenu.prototype.options.nativeMenu = false;
});
</script>
<script src="Scripts/CustomScripts/jquery.mobile-1.4.1.js"></script>