views:

343

answers:

1
<script type="text/javascript">
(function () {
        var ButtonGroup = YAHOO.widget.ButtonGroup;
        var onCheckedButtonChange = function (p_oEvent) {
        };
        YAHOO.util.Event.onContentReady("mediaFilterButtonsFieldset", function () {
            var oButtonGroup = new ButtonGroup("mediaFilterButtons");
            oButtonGroup.on("checkedButtonChange", onCheckedButtonChange);
        });
}());
</script>
<div id="resultInfo">
  <form id="button-example-form" name="button-example-form" method="post">
      <fieldset id="mediaFilterButtonsFieldset">
          <div id="mediaFilterButtons" class="yui-buttongroup ie7filter" style="z-index:11;">
            <div id="mediaFilterLabel">Go to</div>
            <input id="radio1" class="filter_but" type="radio" name="0" value="First" checked rel="0" >
            <input id="radio2"  class="filter_but" type="radio" name="2" value="Second" rel="2">
            <input id="radio3"  class="filter_but" type="radio" name="1" value="Third" rel="1">
          </div>
      </fieldset>
  </form>
</div>

These are my YUI buttons. They're just 3 radio buttons turned into "buttons"--literally. My question is this:

After people click the third button, I cannot manually check the first button anymore. How can I manually check "radio1"?

Edit: According to the official YUI website, there is a method called "set". But I don't know how to use that in this buttonGroup.

+3  A: 

The radio buttons must all have the same name attribute in order for them to be grouped together.

Jeremy
Hmm. Actually, I just want to manually "set" the radio1 to "checked", true. How can I do that?
TIMEX
Try putting `true` in quotes: `$("#radio1").attr("checked","true");`
Jeremy
Or with YUI: YAHOO.util.Dom.setAttribute("radio1", "checked", true)
Bialecki