Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I ended up fixing this problem on my own using jquery to create the div and it's nesting on pageload, the divs are generated with an error class that gives display:none. A custom errorPlacement function nests the error in the correct div. Then I used a custom validator highlight function to remove the class that hides the element. Then I used the unhighlight function to re-add the class to re-hide the div.</p> <pre><code>$(function() { //Generate the elements and assign attributes var errorWrap = document.createElement('div'); $(errorWrap).addClass('errorWrap hideError'); var errorTop = document.createElement('div'); $(errorTop).addClass('errorTop'); var topSpan = document.createElement('span'); var errorContent = document.createElement('div'); $(errorContent).addClass('errorContent'); var errorBottom = document.createElement('div'); $(errorBottom).addClass('errorBottom'); var bottomSpan = document.createElement('span'); //Place the elements directly after each dd element $("dl &gt; dd").append(errorWrap); $("div.errorWrap").append(errorTop) .append(errorContent) .append(errorBottom); $("div.errorTop").append(topSpan); $("div.errorBottom").append(bottomSpan); //Add custom validator defaults $.validator.setDefaults({ errorPlacement: function(error, element) { $(element).nextAll('.errorWrap').children('.errorContent').append(error); }, highlight: function(element) { $(element).nextAll('.errorWrap').removeClass('hideError'); }, unhighlight: function(element) { $(element).nextAll('.errorWrap').addClass('hideError'); } }); } </code></pre> <p>Although I'm sure this could have been done more shorthand, I really like this technique because I didn't have to update any of my pages that contained forms to get it to work. All of the nested divs are dynamically created by javascript, so I can include a global file to any page with forms and it will just work. Thanks for all who offered suggestions.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload