2

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

LorenzoR
  • 421
  • 2
  • 14
Eric Belair
  • 10,574
  • 13
  • 75
  • 116

1 Answers1

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

$("#disable_button").click(function(){
    // What goes here?
    $('#op_b').attr("disabled", "disabled");
    $("#options").buttonset("refresh");
});
Eric Belair
  • 10,574
  • 13
  • 75
  • 116
Biff MaGriff
  • 8,102
  • 9
  • 61
  • 98
  • 1
    Excellent concise answer, thought I will use a jQuery selector in place of `document.getElementById()` and `attr("disabled", "disabled")` in place of `disabled = true` – Eric Belair Oct 23 '12 at 18:22
  • 2
    In that case I would suggest using `prop` instead of `attr`. http://stackoverflow.com/questions/5874652/prop-vs-attr – Biff MaGriff Oct 23 '12 at 18:29
  • Good point. I'm not 100% the version of jQuery this site uses supports prop() yet. But I do need to get in the habit.... – Eric Belair Oct 24 '12 at 00:09