asp.net mvc - jQuery Validation on entire page -


i have webpage developed in asp.net mvc 3 , using jquery validator validate fields.

  $.validator.setdefaults({     errorcontainer: "#validationsummary, #validationnotice",     highlight: function (element, errorclass) {         $(element).css("border", "1px dotted red");     },     unhighlight: function (element, errorclass) {         $(element).css("border", "1px solid black");     } }); 

this give fields "red dotted border" when aren't valid.

i have text want show if fields valid in page .

        <div class="readytosend" style="margin-top:50px;">                    fields valid.         </div> 

so want hide "readytosend" if page isn't valid , show if of fields on page valid.

try this

$.validator.setdefaults({     errorcontainer: "#validationsummary, #validationnotice",     highlight: function (element, errorclass) {         $(element).css("border", "1px dotted red");         $(".readytosend").hide();     },     unhighlight: function (element, errorclass) {         $(element).css("border", "1px solid black");         if($("#yourformname").validate().checkform()) {             $(".readytosend").show();         }     } }); 

make sure add display: none on readytosend div


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -