1

I have some buttonsets that contain radio inputs and want them to be disabled initially.

Passing in the disabled option when constructing the buttonset doesn't work.

$("#a").buttonset({disabled: true});
$("#b").buttonset({disabled: true});
$("#c").buttonset({disabled: true});
$("#d").buttonset({disabled: true});

However, calling the button disable method does.

$("#a").buttonset("disable");

Does anyone know why the first piece of code doesn't work?

Michael
  • 5,994
  • 7
  • 44
  • 56

2 Answers2

4

You can initial the buttons as disabled then apply the buttonset using:

// parent-div is the parent for all these buttons
$("#parent-div > input:button").button({disabled:true});
$("#parent-div").buttonset();
Fareed Alnamrouti
  • 30,771
  • 4
  • 85
  • 76
1

After checking out the documentation it seems that the buttonset doesn't allow {disabled: true} structure. If you want to disable the whole buttonset, you should call:

$("#a").buttonset("disable") ;

However, the other code works with button, not buttonset:

$("#a").button({disabled: true}) ;
Juan Ramón
  • 615
  • 1
  • 5
  • 19
  • The documentation is pretty unclear about buttonset isn't it. – Michael Sep 15 '11 at 10:48
  • yes its not mention anything about it but there is a trick that help you without any documentation, just install the firebug and the firequey firefox plugins and you will see all the jquery stored data inside every dom element (tag), just look inside the 'option' property for that tag data and you will know all the options that available for that jquery widget or plugin ;) – Fareed Alnamrouti Dec 27 '11 at 16:31