jquery validation position error label

喜欢而已 提交于 2019-12-13 09:36:05

问题


and this also not worked for me an error occurd when I tried this:

error.insertBefore(element)
error.css('float','left')

or:

error.attr('style','float:left')

only I can add these properties like this:

$(error).someproperty

This is my code as I can't copy paste because I work on TFS and copy/paste is not allowed. Problem is that with this code I can not float left error message. I want that error should appear on left and below the textbox. One thing more, I was just testing and I put float =right in picture above so forget about it. float:left is also not working. I have checked it.


回答1:


As per the documentation, rules('add', rules) is only a method for adding your rules and their messages, nothing else. You've improperly placed errorElement:, wrapper:, and errorPlacement: within your rules('add', rules) method.

errorElement:, wrapper:, and errorPlacement: are not rules. These are called options and therefore would only be placed within .validate(options).

$(document).ready(function(){
    $('#myform').validate({
        errorElement: 'div',
        wrapper: 'div',
        errorPlacement: function(error, element) {
            error.insertAfter(element); // default function
        }
    });
});

Otherwise, I don't know what you're asking and you should put your actual code within the OP, so we don't have to re-type it in order to answer.



来源:https://stackoverflow.com/questions/14625228/jquery-validation-position-error-label

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!