JQuery 移动选择框不起作用 [英] JQuery Mobile Select Box not working

查看:24
本文介绍了JQuery 移动选择框不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这有点疯狂.我已经尝试了几个小时的代码,但没有成功:

<label for="select-choice-1" class="select">选择配送方式:</label><select name="select-choice-1" id="select-choice-1"><option value="standard">标准:7天</option><option value="rush">Rush: 3 天</option><option value="express">快递:第二天</option><option value="overnight">过夜</option></选择>

来自:

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

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

我是不是忘记了什么?

解决方案

如果你查看网页的源代码,你可以看到它在一个表单标签中:

所以在表单标签之间添加这个会得到想要的结果:Live Example Link

<div data-role="fieldcontain"><label for="select-choice-1" class="select">选择配送方式:</label><select name="select-choice-1" id="select-choice-1"><option value="standard">标准:7天</option><option value="rush">Rush: 3 天</option><option value="express">快递:第二天</option><option value="overnight">过夜</option></选择>

</表单>

另一个问题可能是:

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

data-native-menu="false"

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?

解决方案

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" 

这篇关于JQuery 移动选择框不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆