jQuery Mobile 显示隐藏的选择元素 [英] jQuery Mobile displays hidden select element
问题描述
看到这个带有 display:none
的 select
元素.尽管如此,在 jQuery Mobile 中它仍然显示:
我正在尝试显示/隐藏依赖于其他用户操作的 jQuery Mobile select
元素,因此我要执行上述操作.
有什么想法吗?
当您的页面加载时,jQuery Mobile 会增强您的页面以使其具有移动外观.不幸的是,jQuery mobile 当前存在一个问题,即它无法将自定义类(甚至自定义样式,通过 style 属性)附加到增强元素.请检查 https://github.com/jquery/jquery-mobile/issues/3577 以了解问题.作为此问题仍未解决的解决方法,您实际上可以将其包装在 div 元素中并改为控制 div 包装器的显示.
<select data-mini="true" data-native-menu="false" id="dddd" name="dddd" data-theme="c" onChange="" style="display:none"><option value="1">一个 optinos</option></选择>
ui-screen-hidden
是用于隐藏元素的 jquery mobile 定义的样式规则(在 jquery.mobile..css 中).
See this select
element with display:none
. In jQuery Mobile it is displayed despite this:
<select id="dddd" name="dddd"
data-mini="true" data-native-menu="false" data-theme="c"
onChange=""
style="display:none">
<option value="1">An optinos</option>
</select>
I'm trying to show/hide jQuery Mobile select
elements dependent on other user actions hence why I'm doing the above.
Any ideas?
When your page loads, jQuery Mobile enhances your page to have it the mobile look-and-feel. Unfortunately, there is currently an issue with jQuery mobile that it cannot attach custom classes (and even custom styles, by the style attribute) to enhanced elements. Please check https://github.com/jquery/jquery-mobile/issues/3577 for the issue. As a workaround while this issue is still not resolved, you may actually wrap it inside a div element and control the display of the div wrapper instead.
<div id="dddd-wrapper" class="ui-screen-hidden">
<select data-mini="true" data-native-menu="false" id="dddd" name="dddd" data-theme="c" onChange="" style="display:none">
<option value="1">An optinos</option>
</select>
</div>
ui-screen-hidden
is a jquery mobile defined style rule (in jquery.mobile..css) for hiding an element.
这篇关于jQuery Mobile 显示隐藏的选择元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!