如何禁用jQuery-UI buttonset的一个按钮?

时间:2012-10-23 16:08:28

标签: javascript jquery jquery-ui jquery-ui-button jqueryi-ui-buttonset

此处示例:

http://jsfiddle.net/UVHtu/19/

我需要填空:

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" />
​

JavaScript的:

$("#options").buttonset();

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

1 个答案:

答案 0 :(得分:9)

$("#options").buttonset();

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