Possible Duplicate:
Triggering jquery event function at page load
I have a function to do something when a checkbox in a checkbox group is clicked to be checked. But now, I want something more. When the page is first time loaded, I have couple of the checkboxes pre-checked, so I want the function can be called for those checked checkbox, then, when user click checkbox, the same function will run again.
I tried .bind("ready, click",function())
... doesn't work.
here is the current code which is working fine for click event, thanks!
<script>
$(document).ready(function(){
$('.list_item').click(function(e){
var facility_id = $(this).val();
if ($(this).is(':checked')) {
do somthing 1;
}
});
} else {
do somthing 2;
}
}
});
})
</script>