javascript - jQuery Mobile – 切换单选按钮的启用和禁用状态

标签 javascript jquery html css jquery-mobile

我有一个单选按钮,我希望能够通过 jQuery Mobile 启用和禁用它。

单选按钮代码:

<input type="radio" disabled="disabled" value="option1" />

尝试过:

$('input[type="radio"]').removeAttr('disabled');

$('input[type="radio"]').attr('disabled', '');

两者似乎都无法将按钮切换为启用。

最佳答案

<input type="radio" id="rdoToggle" value="option1" />
$("input[type='radio']").checkboxradio('enable');

Refer the documnentation , jQuery 和 jQuery Mobile 在这个 Action 上是不同的。

$('#rdoToggle').toggle(function() {
  $("input[type='radio']").checkboxradio('enable');
}, function() {
  $("input[type='radio']").checkboxradio('disable');
});

关于javascript - jQuery Mobile – 切换单选按钮的启用和禁用状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9077348/

相关文章:

javascript - 如何实现Google饼图(带有图例显示和相应的值)

javascript - 有没有办法找出用户拥有的最高角色?

javascript - 上一个完成时 jQuery 启动函数

javascript - 为什么在 Jquery 中 "on click"只更新一次?然后第二次在 $(this) 上显示 "undefined"?

JQuery 验证至少一个复选框被选中

javascript - 循环遍历具有特定类的 div 中的所有复选框

html - 在浏览器中下载的 EML 文件,而不是使用电子邮件应用程序内联打开

javascript - 对javascript中的数字比较感到困惑

javascript - 用 highcharts pie 扫一扫动画

jquery - 数据表:忽略嵌套向下钻取表时的 CSS 奇数/偶数样式