Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://speckycdn.sdm.netdna-cdn.com/wp-content/uploads/2009/08/jqueryform3.jpg" rel="nofollow noreferrer">What you want to achieve</a> is slightly more complex than simply changing the error <code>class</code> or message styles.</p> <p>You must focus your efforts on the <code>errorPlacement</code> and <code>success</code> callback functions. See documentation: <a href="http://jqueryvalidation.org/validate" rel="nofollow noreferrer">jqueryvalidation.org/validate</a></p> <p>Optionally, you can install another plugin that will create these tooltips for you. I use Tooltipster, but how you integrate the tooltip plugin depends on what methods are made available by its developer.</p> <hr> <p>First, initialize the Tooltipster plugin (<a href="http://calebjacob.com/tooltipster/#options" rel="nofollow noreferrer">with any options</a>) on <strong>all</strong> specific <code>form</code> elements that will display errors:</p> <pre class="lang-js prettyprint-override"><code>$(document).ready(function () { // initialize tooltipster on form input elements $('#myform input[type="text"]').tooltipster({ trigger: 'custom', // default is 'hover' which is no good here onlyOne: false, // allow multiple tips to be open at a time position: 'right' // display the tips to the right of the element }); }); </code></pre> <p>Second, use <a href="http://calebjacob.com/tooltipster/#advanced" rel="nofollow noreferrer">Tooltipster's advanced options</a> along with the <a href="http://docs.jquery.com/Plugins/Validation/validate#toptions" rel="nofollow noreferrer"><code>success:</code> and <code>errorPlacement:</code> callback functions built into the Validate plugin</a> to automatically show and hide the tooltips as follows:</p> <pre class="lang-js prettyprint-override"><code>$(document).ready(function () { // initialize validate plugin on the form $('#myform').validate({ // any other options &amp; rules, errorPlacement: function (error, element) { $(element).tooltipster('update', $(error).text()); $(element).tooltipster('show'); }, success: function (label, element) { $(element).tooltipster('hide'); } }); }); </code></pre> <p><strong>Working Demo: <a href="http://jsfiddle.net/kyK4G/" rel="nofollow noreferrer">http://jsfiddle.net/kyK4G/</a></strong></p> <hr> <p>Source: <a href="https://stackoverflow.com/q/14741688/594235">How to display messages from jQuery Validate plugin inside of Tooltipster tooltips?</a></p>
    singulars
    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