Difference between errorContainer and errorLabelContainer parameters in jQuery Validate
Usage ErrorLabelContainer
I can display all errors on my page in one div
.
What is it errorContainer
?
source to share
Please refer to the official documentation where all this is clearly explained .
errorLabelContainer
... All error labels are displayed inside an unordered list with the identifier "messageBox" , as specified in the selector passed aserrorContainer
Option .
In other words, as an example errorLabelContainer
contains errors like an unordered list. This unordered list is included in errorContainer
.
Usage example:
$('form').validate({
errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1 ul",
wrapper: "li"
});
Will give way to this markup ...
<div id="messageBox1"> <!- errorContainer ->
<ul> <!- errorLabelContainer ->
<li>Field is required</li> <!- wrapper ->
<li>Enter a valid email</li> <!- wrapper ->
</ul>
</div>
To play around with how this works, you can create a jsFiddle demo and check the DOM to see how the rendered HTML is constructed.
source to share