Skip to content

Instantly share code, notes, and snippets.

@winwu
Created December 16, 2015 09:17
Show Gist options
  • Save winwu/d14dea5b711aa518927d to your computer and use it in GitHub Desktop.
Save winwu/d14dea5b711aa518927d to your computer and use it in GitHub Desktop.
// 檔名叫做 startup.js
if (Meteor.isClient) {
Meteor.startup(function(){
//參考自 http://stackoverflow.com/questions/18754020/bootstrap-3-with-jquery-validation-plugin
$.validator.setDefaults({
highlight: function(element) {
$(element).closest('.form-group').addClass('has-error');
},
unhighlight: function(element) {
$(element).closest('.form-group').removeClass('has-error');
},
errorElement: 'span',
errorClass: 'help-block',
errorPlacement: function(error, element) {
if(element.parent('.input-group').length) {
error.insertAfter(element.parent());
} else {
error.insertAfter(element);
}
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment