Created
December 16, 2015 09:17
-
-
Save winwu/d14dea5b711aa518927d to your computer and use it in GitHub Desktop.
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
// 檔名叫做 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