Code to ensure that at least one checkbox is checked : Doesn't work in Chrome or Firefox
<p>I have a checkbox list for weekdays and I want to make sure that at least one day is selected at all times. I've created the following code but it doesn't seem to work correctly. In IE 8 it works but intermittently and in chrome and firefox it doesn't work at all. Can any one explain what I'm doing wrong?</p>

<p>Cheers</p>

<p>Pete</p>

<pre><code>$(function () {

    var weekdays = $("input[name='WeekDays']");

    $(weekdays).change(function (e) {

        var count = $(weekdays).filter(":checked").length;

        if (count &lt; 1) {

            e.preventDefault();

        }

    });

});
</code></pre>
