Javascript 如何禁用jQuery UI按钮集的一个按钮?

Javascript 如何禁用jQuery UI按钮集的一个按钮?,javascript,jquery,jquery-ui,jquery-ui-button,jqueryi-ui-buttonset,Javascript,Jquery,Jquery Ui,Jquery Ui Button,Jqueryi Ui Buttonset,示例如下: 我需要填空: HTML: <div id="options"> <input type="radio" id="op_a" name="op" value="a" /> <label for="op_a">Option A</label> <input type="radio" id="op_b" name="op" value="b" /> <label for="op_b">

示例如下:

我需要填空:

HTML:

<div id="options">
    <input type="radio" id="op_a" name="op" value="a" />
    <label for="op_a">Option A</label>
    <input type="radio" id="op_b" name="op" value="b" />
    <label for="op_b">Option B</label>
    <input type="radio" id="op_c" name="op" value="c" />
    <label for="op_c">Option C</label>
</div>
<input type="button" id="disable_button" value="Disable Option B" />
​
$("#options").buttonset();

$("#disable_button").click(function(){
    // What goes here to disable option B?
});

非常简洁的回答,我想我会使用jQuery选择器代替
document.getElementById()
attr(“disabled”、“disabled”)
代替
disabled=true
,在这种情况下,我建议使用
prop
而不是
attr
。说得好。我还不是这个站点使用的jQuery的100%版本支持prop()。但我确实需要养成这个习惯。。。。
$("#options").buttonset();

$("#disable_button").click(function(){
    // What goes here?
    $('#op_b').attr("disabled", "disabled");
    $("#options").buttonset("refresh");
});