Manually bind JQuery validation after Ajax request

前端 未结 5 1359
轮回少年
轮回少年 2021-01-03 02:27

I\'m requesting an ASP.net MVC view into a live box and the view contains form fields that have been marked up with attributes to be used by JQuery\'s unobtrusive validators

5条回答
  •  迷失自我
    2021-01-03 03:18

    var $form = $("form");
    
    $form.unbind();
    $form.data("validator", null);
    
    $.validator.unobtrusive.parse(document);
    // Re add validation with changes
    $form.validate($form.data("unobtrusiveValidation").options);
    

提交回复
热议问题