I have a script which checks all the checkboxes that have same class.

However, I have put a condition of unchecking all of them which is not working.

Here's my code

```
function check_all() {
    if ($('#all_check').prop("checked")) {
        $('.chk').prop("checked", "true");
    } else {
        $('.chk').prop("checked", "false");
    }
}

```

The line `$('.chk').prop("checked", "false");` is having some problem, but what I can't find out.

Only this section of the code is not working.