Michael
Michael

Reputation: 6172

jQuery UI buttonset disabled constructor option not working

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?

Upvotes: 1

Views: 1833

Answers (2)

Fareed Alnamrouti
Fareed Alnamrouti

Reputation: 32182

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();

Upvotes: 4

Juan Ramón
Juan Ramón

Reputation: 636

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

Upvotes: 1

Related Questions