问题
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