jQuery Mobile如何检查按钮是否被禁用? [英] jQuery Mobile how to check if button is disabled?
问题描述
我在jQuery Mobile网页上禁用了这样的按钮:
I disable the button like this on my jQuery Mobile webpage:
$(document).ready(function() {
$("#deliveryNext").button();
$("#deliveryNext").button('disable');
});
我可以通过
$("#deliveryNext").button('enable');
但是如何检查按钮是否已禁用或启用?
But how do i check if the button is disabled or enabled?
此命令给出未定义":
$("#deliveryNext").attr('disabled')
一些想法?
我发现$(#deliveryNext").button('disable')仅可以更改按钮的样式,单击后效果很好,因此我还需要禁用按钮.我尝试了.attr('disabled','disabled'),但是当我随后测试.attr('disabled')时,我却无法定义...
i find out that $("#deliveryNext").button('disable') only seams to change the style on the button, the clicking works fine after so i need to disable the button some how also.. i tried .attr('disabled', 'disabled') but when i then test .attr('disabled') i get undefined...
Edit2:有关我的真实"问题的更多信息,请参见如何禁用jQuery Mobile中的链接按钮?
more about my "real" problem at How to disable a link button in jQuery Mobile?
推荐答案
尝试:is
选择器
$("#deliveryNext").is(":disabled")
这篇关于jQuery Mobile如何检查按钮是否被禁用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!