Question: I want to programmatically check a checkbox and trigger the checkbox's onchange function

I have tried `("#myCheckbox").click()` but it only checks it and does not call its onchange function

How can I get the onchange function to execute as well?

**edit:**

When the document is ready i need the checkbox checked and its on change function called programatically.

Answer: 
How about something like this:

```
$('#myCheckbox').prop({ checked: true });
theOnchangeFunction();

```

---

```
$('#myCheckbox').on('change', theOnchangeFunction);

```

---

```
function theOnchangeFunction(){

}

```
Don't understand, it works : <http://jsfiddle.net/FW5Lp/>

```
<input type="checkbox" id="myc">
    <button id='clic'>click</button>

$('#myc').on('change', function(){alert('ca change');});

$('#clic').on('click', function(){$('#myc').trigger('click') });

```