Enable or Disable validators using javascript in asp.net

In this tutorial I will show you that how can we enable & disable validator controls using javascript.

Lets say bellow is the control which I want to disable

                <asp:requiredfieldvalidator id="reqValidator"
                    display="Dynamic"
                    runat="server"
                    errormessage="It is required"
                    controltovalidate="mtTextbox" />

to enable & disable this control we need to find this control in javascript with its clientID & then enable or disable like bellow.

var reqValidatorObject = document.getElementById('<%= reqValidator.ClientID %>');
ValidatorEnable(reqValidatorObject, false);    

in above code
false = validator is disabled
true = validator is enabled

So this is how we can enable or disable validators using javascript in asp.net

admin