Hello,

Trying to use jquery to validate that a minimum of 7 check boxes are
selected.  the code is as follows:

$(document).ready(function()
{
        $("form").submit(function()
        {
                if (!isCheckedById("AreasOfInterest[]"))
                {
                        alert ("Please select at least 7 items");
                        return false;
                }
                else
                {
                        return true; //submit the form
                }
        });

        function isCheckedById(id)
        {
                var checked = $("inp...@id="+id+"]:checked").length;
                if (checked < 7)
                {
                        return false;
                }
                else
                {
                        return true;
                }
        }
});

It works if i set the (checked == 0) and then at least 1 is
selected... but when i run it as is... it won't submit even if more
than 7 are selected...  Is my code wrong?? is the variable checked not
an integer??  help!!

Reply via email to