Jquery Validation plug-in custom error placement

后端 未结 4 665
终归单人心
终归单人心 2020-11-28 08:26

Using the jQuery Validation plug-in for the following form:

4条回答
  •  隐瞒了意图╮
    2020-11-28 08:36

    I found that using .insertAfter rather than .appendTo works:

    jQuery.validator.setDefaults({
        errorPlacement: function(error, element) {
            error.insertAfter('#invalid-' + element.attr('id'));
        }
    });
    

提交回复
热议问题