if ( !this.labelContainer.append(label).length )
this.settings.errorPlacement
? this.settings.errorPlacement(label, $(element) )
: label.insertAfter(element);
(this code is from validate plugin, it repeats for each input)
label
is <label>text</label>
element
is <input />
This works good, it adds label
directly after the element
.
Looks like this:
<dd>
<div>
<input />
<label>text</label>
</div>
</dd>
How to place label
after the <div>
(element
's parent), not after the element
?
Full code of the script:
http://www.jsfiddle.net/YSSCE/1/ (search for label.insertAfter(element)
)