JQuery.Validate adding dynamic rules with messages

后端 未结 3 1302
名媛妹妹
名媛妹妹 2021-02-01 17:42

I have a form on which I am using jquery.validate. I initially call validate with a set of rules and custom messages...

$(\"#formName\").validate( {
  rules: {
          


        
3条回答
  •  广开言路
    2021-02-01 18:33

    as an answer to this old issue, I do like this to get the meassges inside the rules object.

    After you have added the rules you can add messages like this:

    var inputRules = $('input').rules();
    inputRules.messages = {required: 'your message'};
    

    Good luck!

提交回复
热议问题