javascriptjqueryjquery-uijquery-ui-buttonjqueryi-ui-buttonset

How can I disable one button of a jQuery-UI buttonset?


Example here:

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

I need to fill in the blank:

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?
});


Solution

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