我有三个输入单选按钮,例如
<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] 删除。
我来说两句