checkbox change
checkbox change
by imparator
HTML
<input type="checkbox" id="checkbox1" /> <br />
<input type="text" id="textbox1" />
JavaScript
$(document).ready(function() {
//set initial state.
$('#textbox1').val($(this).is(':checked'));
$('#checkbox1').change(function() {
$('#textbox1').val($(this).is(':checked'));
});
/*
$('#checkbox1').mousedown(function() {
if (!$(this).is(':checked')) {
this.checked = confirm("Are you sure?");
$(this).trigger("change");
}
});
*/
});