gpt4 book ai didi

jquery - 使用 JQuery 禁用 JQuery Mobile 按钮

转载 作者:行者123 更新时间:2023-12-03 22:49:04 25 4
gpt4 key购买 nike

这是我的 JQuery 移动按钮。这可能是一件容易的事。我能够禁用 html 按钮,但我似乎无法通过此标记获得它。

<a href="" data-role="button"  class="answer_but" id="a" data-theme="b" data-answer="1">

这可能是一个简单的问题。谢谢

最佳答案

Disable Buttons in jQuery Mobile

实例:http://jsfiddle.net/XRjh2/16/

更新:

链接按钮示例:

JS

var clicked = false;

$('#myButton').click(function() {
if(clicked === false) {
$(this).addClass('ui-disabled');
clicked = true;
alert('Button is now disabled');
}
});

$('#enableButton').click(function() {
$('#myButton').removeClass('ui-disabled');
clicked = false;
});

HTML

<div data-role="page" id="home">
<div data-role="content">

<a href="#" data-role="button" id="myButton">Click button</a>
<a href="#" data-role="button" id="enableButton">Enable button</a>

</div>
</div>

注意:-http://jquerymobile.com/demos/1.0rc2/docs/buttons/buttons-types.html

Links styled like buttons have all the same visual options as true form-based buttons below, but there are a few important differences. Link-based buttons aren't part of the button plugin and only just use the underlying buttonMarkup plugin to generate the button styles so the form button methods (enable, disable, refresh) aren't supported. If you need to disable a link-based button (or any element), it's possible to apply the disabled class ui-disabled yourself with JavaScript to achieve the same effect.

关于jquery - 使用 JQuery 禁用 JQuery Mobile 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6005289/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com