kralco626
kralco626

Reputation: 8624

use Jquery to check checkbox in Jquery buttonset

I have some checkboxes in a button set and I want to use Jquery to check one of the checkboxes.

It works, however, the visual representation of the checkbox does not update. ie, after executing $('#chk').attr('checked',true); the checked value is true, but the checkbox apears unchecked.

Demoed here: http://jsfiddle.net/kralco626/jzVjT/1/

Thanks!

Upvotes: 4

Views: 5634

Answers (2)

Erik  Reppen
Erik Reppen

Reputation: 4635

Try

'true'

rather than

true

Attributes are always string values.

Edit:

Never mind. No clue on buttonset functionality but things aren't behaving normally. Check the documentation for the API.

Upvotes: -1

Nick Craver
Nick Craver

Reputation: 630389

You need to call the refresh method on the buttonset to update the visual state after programmatic changes to the checked state, like this:

$("#test").buttonset("refresh");

You can test it out here.

Upvotes: 16

Related Questions