简体   繁体   English

如何禁用/启用jQuery移动按钮?

[英]how to disable / enable jquery mobile buttons?

I am trying to disable the button I tap on and enable the rest. 我试图禁用我点击的按钮并启用其余按钮。 Here is an example 这是一个例子

<div class="container">
    <input type="button" class="status" value="Input1">
    <input type="button" class="status" value="Input2" disabled="">
    <input type="button" class="status" value="Input3" disabled="">
</div>

var container = $('.container');

container.on("click", '.status', function () {
    $('.status').prop('disabled', false).button(); // set all buttons to enabled
    $(this).prop('disabled', true).button();  // set the one I clicked to disabled
});

jsfiddle jsfiddle

But it's not working, How can I accomplish enable\\disable with jQuery-mobile? 但这不起作用,如何使用jQuery-mobile启用启用/禁用功能?

This is the right way to disable after initialization: 这是初始化后禁用的正确方法:

$('.status').button('enable');
$(this).button('disable');    

Always check the API site 始终检查API网站

LIVE DEMO 现场演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM