<input type="checkbox" name="test" checked="checked" id="double-fields">
$('#double-fields').on('change', function () {
$(this).removeAttr('checked');
});
$('#double-fields').on('change', function () {
$(this).attr('checked', function(_, attr){ return !attr});
});