Created
May 9, 2014 19:24
-
-
Save cfmitrah/c4c02b898c9cd281c3ac to your computer and use it in GitHub Desktop.
jQuery validation error placement for Semantic-UI
This file contains 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
jQuery(document).ready(function($) { | |
$.validator.setDefaults({ | |
errorClass: 'errorField', | |
errorElement: 'div', | |
errorPlacement: function(error, element) { | |
error.addClass("ui red pointing above ui label error").appendTo( element.closest('div.field') ); | |
}, | |
highlight: function(element, errorClass, validClass) { | |
$(element).closest("div.field").addClass("error").removeClass("success"); | |
}, | |
unhighlight: function(element, errorClass, validClass){ | |
$(element).closest(".error").removeClass("error").addClass("success"); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment