Created
August 11, 2011 01:33
-
-
Save tadamak/1138720 to your computer and use it in GitHub Desktop.
MVC3でjquery.validate.jsのエラー表示カスタマイズ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var validator = $("#form").data('validator'); | |
validator.settings.errorPlacement = function (error, element) { | |
// Error placement for single elements | |
var offset = element.offset(); | |
error.insertBefore(element) | |
error.addClass('message'); // add a class to the wrapper | |
error.css('position', 'absolute'); | |
error.css('left', offset.left + element.outerWidth()); | |
error.css('top', offset.top - (element.height() / 2)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment