jQuery验证消息问题

伊菲

我有三个输入单选按钮,例如

<input type="radio" name="specific_parent" id="parent_one" class="radio" value="existing_parent"><label class="redio_label" for="existing_parent">Existing Parent</label>
<input type="radio" name="specific_parent" id="parent_two" class="radio" value="prospective_parent"><label class="redio_label" for="prospective_parent">Prospective Parent</label>
<input type="radio" name="specific_parent" id="parent_third" class="radio" value="other"><label class="redio_label" for="other">Other</label>

我已经像这样应用了jQuery验证:

rules: {
   specific_parent: {
      required: true
   }
},
messages: {
  specific_parent: {
      required: 'Please select radio button'
  }
}

问题是它在第一个输入单选按钮后显示错误消息,并且我的布局中断了。

在此处输入图片说明

阿罗帕塔克

使用errorPlacement

 errorPlacement: function (error, element) {
      error.insertBefore(element);
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章