jquery validation errorPlacement trouble

独自空忆成欢 提交于 2021-02-10 22:41:31

问题


The example of errorPlacement in the validation plugin section of jquery.com gives this example:

error.appendTo( element.parent("td").next("td") );

Which adds the error to the "td" after the input. I am trying to do a similar thing but I am not using "td" elements.

This is what my HTML looks like:

<p><label>Employee Number:</label><input type="text" name="eenum" id="eenum" class="required" /><span></span></p>

I am trying to get the error to appear in the "span" after the input, but nothing I have been trying works correctly. If the error appears at all, it is always preceding the input.


回答1:


So, what did you try? It should be

error.appendTo(element.next("span"));


来源:https://stackoverflow.com/questions/6069450/jquery-validation-errorplacement-trouble

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