首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jQuery手机如何设置hidePlaceholderMenuItems值

问jQuery手机如何设置hidePlaceholderMenuItems值
EN

Stack Overflow用户
提问于 2013-02-03 03:11:12
回答 1查看 211关注 0票数 0

我有一个使用json填充的select项,但是jquery移动select没有显示默认的选定值。我已经阅读了文档,他们说需要设置以下内容:

代码语言:javascript
复制
$.mobile.selectmenu.prototype.options.hidePlaceholderMenuItems = false;

但我真的不知道该怎么做

EN

回答 1

Stack Overflow用户

发布于 2013-02-03 05:11:59

在初始化jQuery移动端之前,需要在mobileinit事件中进行设置,如下所示:

代码语言:javascript
复制
<head>
    <title>jQM Complex Demo</title>
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0"/>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <script>
        $(document).on("mobileinit", function () {
            $.mobile.selectmenu.prototype.options.hidePlaceholderMenuItems = true;
        });        
    </script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>    
</head>

示例:http://jsfiddle.net/Gajotres/VmsRg/

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14665457

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档