how to check a checkbox and trigger change on page load.
<?php
CheckBoxList::create(array(
"name"=>"having_task",
"data"=>array(
"Having Tasks"=>"yes",
),
"clientEvents"=>array(
"change"=> "function(params){
var table = $('#example').DataTable();
console.log('have_task');
if(params.value[0]==='yes'){
table.columns(5).search('yes').draw();
}
else
$('#form1').submit();
}"
),
));
?>
here, my check box is unchecked and works perfect when I check. But what I want is,
1)to check this checkbox during page load itself.
2)also to trigger change when checkbox is selected,
this must be done on the client side.