Jquery validation error placement (radio buttons)

前端 未结 4 1262
有刺的猬
有刺的猬 2021-02-05 11:19

I\'m trying to use the Jquery validation plugin to validate my form. I have error messages appearing to the right of most of my input elements, but radio buttons are giving me n

4条回答
  •  日久生厌
    2021-02-05 12:09

    You can also use this method to place an error for a specific field wherever you want.

    errorPlacement: function(error, element) {
      if (element.attr("name") == "PhoneFirst" || element.attr("name") == "PhoneMiddle" || element.attr("name") == "PhoneLast") {
         error.insertAfter("#requestorPhoneLast");
      } else {
         error.insertAfter(element);
      }
    },
    

提交回复
热议问题