jeudi 4 août 2016

JQuery checkbox required validation works only first time

I am having a weird issue while placing a validation for checkbox. it is working fine on first time when I didn't check the checkbox and hit submit button but if I hit the button again it won't check validation rule and gives an error instead.

CONTROL:

<asp:CheckBox runat="server" ID="IAgreedCheckBox" placeholder="Required Field"/>

VALIDATION:


$('form').validate({
        rules: {

            '<%=IAgreedCheckBox.UniqueID%>': {
                required: true
            }
        },
        submitHandler: function (form) {
            document.getElementById("ValidEntry").value = "TRUE";
            return true;
        }
    })

ERROR ON 2nd TIME SUBMIT BUTTON CLICK:

Unhandled exception at line 2, column 12711 in http://ift.tt/1xDNnh9

0x800a139e - JavaScript runtime error: Syntax error, unrecognized expression: label[for='ctl00$body$IAgreedCheckBox'], label[for='ctl00$body$IAgreedCheckBox'] *, #ctl00$body$IAgreedCheckBox-error




Aucun commentaire:

Enregistrer un commentaire