Test case for jQuery Ticket 8060
Set checked on checkbox
by jitter
HTML
<input type="checkbox" id="foo" />
<button id="toggle"> Toogle checked state </button>
JavaScript
//Following the recommendation on
//http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_check.2Funcheck_a_checkbox_input_or_radio_button.3F
//true/false is used as 2nd argument to attr when setting checked
$( "#toggle" ).toggle(
function() {
$( "#foo" ).attr( "checked", true );
},
function() {
$( "#foo" ).attr( "checked", false );
}
);