JQuery Mobile 选择框不起作用

发布于 2024-11-09 20:38:25 字数 809 浏览 0 评论 0原文

这有点疯狂了。 我已经尝试了几个小时的代码,但没有运气:

<div data-role="fieldcontain">
    <label for="select-choice-1" class="select">Choose shipping method:</label>
    <select name="select-choice-1" id="select-choice-1">
        <option value="standard">Standard: 7 day</option>
        <option value="rush">Rush: 3 days</option>
        <option value="express">Express: next day</option>
        <option value="overnight">Overnight</option>
    </select>
</div>

来自:

http://jquerymobile.com/demos/1.0a4.1/#docs/forms/forms-selects.html

当我在手机上测试它时,没有下拉菜单......实际上,什么也没有发生全部。

我是不是忘记了什么?

This is getting a bit crazy.
I have been trying the code for hours now and no luck:

<div data-role="fieldcontain">
    <label for="select-choice-1" class="select">Choose shipping method:</label>
    <select name="select-choice-1" id="select-choice-1">
        <option value="standard">Standard: 7 day</option>
        <option value="rush">Rush: 3 days</option>
        <option value="express">Express: next day</option>
        <option value="overnight">Overnight</option>
    </select>
</div>

From:

http://jquerymobile.com/demos/1.0a4.1/#docs/forms/forms-selects.html

When I test it on my mobile there is no dropdown ... actually, nothing hapens at all.

I'm I forgetting something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

国产ˉ祖宗 2024-11-16 20:38:25

如果您查看网页的源代码,您可以看到它位于表单标记中:

<form action="#" method="get">

因此,在表单标记之间添加此内容将获得所需的结果: 实时示例链接

<form action="#" method="get">
    <div data-role="fieldcontain">
        <label for="select-choice-1" class="select">Choose shipping method:</label>
        <select name="select-choice-1" id="select-choice-1">
            <option value="standard">Standard: 7 day</option>
            <option value="rush">Rush: 3 days</option>
            <option value="express">Express: next day</option>
            <option value="overnight">Overnight</option>
        </select>
    </div>
</form>

另一个问题可能是:

尝试将此标记添加到下拉列表中:Live示例链接

data-native-menu="false" 

If you look at the source of the web page you can see it's in a form tag:

<form action="#" method="get">

So Adding this between the form tags would get the desired results: Live Example Link

<form action="#" method="get">
    <div data-role="fieldcontain">
        <label for="select-choice-1" class="select">Choose shipping method:</label>
        <select name="select-choice-1" id="select-choice-1">
            <option value="standard">Standard: 7 day</option>
            <option value="rush">Rush: 3 days</option>
            <option value="express">Express: next day</option>
            <option value="overnight">Overnight</option>
        </select>
    </div>
</form>

Another problem it could be:

Try adding this tag to the dropdown: Live Example Link

data-native-menu="false" 
风筝在阴天搁浅。 2024-11-16 20:38:25

我遇到了同样的问题,决定是在连接的库中,

我将其包含在头标记中,这个 css

code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css

和这个

code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js

都运行良好!

I had the same problem and the decision is in the connected libraries

I include in head tag this css

code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css

and this

code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js

and all works well!

终陌 2024-11-16 20:38:25

看起来像是从链接直接复制粘贴,您是否包含 jquery 和 < a href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js" rel="nofollow">jquery mobile ?

looks like a direct copy paste from the link did you include jquery and jquery mobile ?

赏烟花じ飞满天 2024-11-16 20:38:25

我最近遇到了这个问题,接受的答案并没有为我解决它。在创建问题的过程中,我找到了解决方案:

当同时使用 jQuery UI 和 jQuery Mobile 时,在脚本列表中,UI 必须位于 Mobile 之前

我有这个:

<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

这导致 UI 优先于我的表单元素,在选择菜单中尤其明显。我改变了这些说法,并且移动设备正确地增强了菜单。

I had this issue recently, and the accepted answer did not fix it for me. In the process of creating a question on it, I figured out the solution:

When using both jQuery UI and jQuery Mobile, UI must come before Mobile in your list of scripts.

I had this:

<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

Which resulted in UI having precedence over my form elements, especially noticeable in select menus. I switched these statements, and the menus were enhanced by Mobile properly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文