What you want to achieve is slightly more complex than simply changing the error class
or message styles.
You must focus your efforts on the errorPlacement
and success
callback functions. See documentation: jqueryvalidation.org/validate
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.
First, initialize the Tooltipster plugin (with any options) on all specific form
elements that will display errors:
$(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
});
});
Second, use Tooltipster's advanced options along with the success:
and errorPlacement:
callback functions built into the Validate plugin to automatically show and hide the tooltips as follows:
$(document).ready(function () {
// initialize validate plugin on the form
$('#myform').validate({
// any other options & rules,
errorPlacement: function (error, element) {
$(element).tooltipster('update', $(error).text());
$(element).tooltipster('show');
},
success: function (label, element) {
$(element).tooltipster('hide');
}
});
});
Working Demo: http://jsfiddle.net/kyK4G/
Source: How to display messages from jQuery Validate plugin inside of Tooltipster tooltips?