Try this
$('input:checkbox:checked').click(function(){
var val=(this).val(); // it will get value from checked checkbox;
})
Here flag is true if checked otherwise false
var flag=$('#ans').attr('checked');
Again this will make cheked
$('#ans').attr('checked',true);