jQuery 2.1.4 bug

jQuery 2.1.4 bug

I have noticed that their is a bug in jQuery 2.1.4. I have made a code through which checking a main checkbox checks all the checkbox in the table. The code works for the first 2 click but does not work from 3 rd click .
The code works correctly when i use jquery 1.4.3.
You can see the page online at - http://www.yogihosting.com/check-uncheck-all-checkbox-using-jquery/
the jquery code is -
<script type="text/javascript">
        $(document).ready(function () {
            $("#mainCheckBox").click(function () {
                if ($(this).is(":checked")) {
                    $("#pageTbody").find('input[type="checkbox"]').each(function () {
                        $(this).attr("checked", true);
                    });
                }
                else {
                    $("#pageTbody").find('input[type="checkbox"]').each(function () {
                        $(this).attr("checked", false);
                    });
                }
            });
        });
    </script>

can i know what's the problem?