jQuery Mobile无法隐藏提交按钮
我正在使用最新版本的jquery mobile,我的问题是我给了Submit按钮一个ID,然后添加了一些CSS以将ID设置为display:none;
I am using the latest version of jquery mobile and my problem is that I have given a submit button an ID and then added some css to set the ID to display:none;
由于某种原因,这不起作用.
For some reason this does not work.
以前有人遇到过这个问题吗?
Has anyone had this problem before?
很难在没有任何代码的情况下告诉您要做什么,但是我认为问题出在jQuery Mobile无法为现有按钮设置样式的事实而是隐藏元素并将其包装在新的div
中,该div
的样式和外观类似于按钮.
It's hard to tell what you're trying to do without any code but I think the problem stems from the fact that jQuery Mobile doesn't style your existing button but rather, hides the element and wraps it in a new div
which is styled to look and behave like a button.
按钮的当前jQuery Mobile标记如下:
The current jQuery Mobile markup for a button looks like this:
<div data-theme="e" class="ui-btn ui-btn-inline ui-btn-corner-all ui-shadow ui-btn-hover-e ui-btn-down-e" aria-disabled="false">
<span class="ui-btn-inner ui-btn-corner-all">
<span class="ui-btn-text">Submit</span>
</span>
<input type="submit" id="submit_btn" value="Submit" data-theme="e" data-inline="true" class="ui-btn-hidden" aria-disabled="false">
</div>
因此,您寻找类ui-btn
的最接近的祖先并将其隐藏:
So you look for the closest ancestor with the class ui-btn
and hide it:
$('#submit_btn').closest('.ui-btn').hide();
如果有更好的方法可以做到这一点,我很想知道.这是一个小提琴,它显示了我的解决方案.
If there's a better way to do this, I'd love to know about it. Here's a fiddle that shows my solution in action.