如何在单选按钮选项之前放置 Jquery 验证错误消息

How to place Jquery Validate error messages in before radio button option

我正在开发一个在线调查表,我正在使用 jquery 移动设备,我使用了 jquery 验证插件。

问题是,jquery 验证错误消息出现在第一个单选按钮选项之后。

如何将错误消息放在第一个单选按钮选项之前。

我尝试使用此代码,但似乎不起作用。

errorPlacement: function(error, element) {
    if (element.is(":radio")) {
       error.appendTo(element.parent());
    } else {
       error.insertBefore(element);
    }
}

我找到答案了,

errorPlacement: function(error, element) {
if (element.is(":radio")) {
error.prependTo(element.parent());
} else { // This is the default behavior of the script for all fields
error.insertAfter(element);
}
}

参考:Answer to the question I had