Using nested error wrappers with jQuery validate plugin
Posted
by RyOnLife
on Stack Overflow
See other posts from Stack Overflow
or by RyOnLife
Published on 2010-03-10T07:04:25Z
Indexed on
2010/03/25
18:43 UTC
Read the original article
Hit count: 769
I am using the jQuery validate plugin. My error labels are styled like tooltips and take many levels of nested divs in order to create. The plugin has a wrapper option that allows for an element type to be specified as a wrapper for the error message, but it's only wrapped once.
Is anyone familiar with how to do nested wrapping?
This isn't my exact markup, but as an example:
<div class="tooltip">
<div>
<div>
<span class="error">This field is required.</span>
</div>
</div>
</div>
* UPDATE *
The response from Chris answers my original question, but creates a new problem. The errors are now being displayed as desired, but the plugin fails to clear them. When a failed validation passes, span.error
is set to display:none
, but the div.tooltip
nested wrapper still displays.
© Stack Overflow or respective owner