0

When I Was Trying To causesvalidation=false for my server side validation control like requiredfieldvalidation.

i want manually causesvalidation=false using javascript but i m not done . is there any solution..

2 Answers 2

2

I am but late to reply to this question but it will be helpful to others

To apply a causesvalidation attribute to a button via jQuery is very simple. All you have to do is assign class to your button for example assign a cancel class to it like below

<a href="URL URL" class="cancel" >Home</a>

within document.ready function of jQuery

 //get your button by class
 var $cancelButton = $(".cancel");

//assign the attribute
$cancelButton.attr("CausesValidation", "False");

by doing this you can assign this validation attribute to any button just assign their class and assign attribute via jQuery.

Sign up to request clarification or add additional context in comments.

Comments

1

Try(Untested):

document.getElementById("<%= YourControl.ClientID  %>").setAttribute("causesvalidation", "false");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.