Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 349
kralco626 Avatar asked Dec 08 '22 00:12

kralco626


1 Answers

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.

like image 106
Nick Craver Avatar answered Dec 09 '22 13:12

Nick Craver