Setting same properties for more fields

后端 未结 5 837
生来不讨喜
生来不讨喜 2021-01-26 19:40

I have two or more text fields and I want to apply the same properties to them, avoiding to write two or more times the same code

This doesn\'t work:

$(\         


        
5条回答
  •  再見小時候
    2021-01-26 19:59

    apply a css class to all fields

    $(".cssClassName").rules("add", {
            required: true,  
             minlength: 3,
              maxlength: 50 ,
            messages:
       {required:"error1",minlength:"error2",maxlength:"error3"}});
    

提交回复
热议问题