I am using jQuery to disable validation controls in an aspx page on load. On a button press I want to enable them. I have coded the script below for this, but there is an issue. Both functions (enabling and disabling validation controls) are fired on page load.
Why are both functions being called?
<script type="text/javascript">
function pageLoad()
{
$.each(Page_Validators, function(index, validator) {
ValidatorEnable(validator, false);
});
$("input[id$='btnNext']").click(enable());
}
function enable()
{
alert ("Enable function called");
$.each(Page_Validators, function(index, validator){
ValidatorEnable(validator, true);
});
}
</script>
Use document ready event in jQuery to disable the controls. Something like
Edit
Replace
with