2016-08-11 22:05:23 +08:00
|
|
|
$.fn.clearFormErrors = function () {
|
2016-07-22 19:29:01 +08:00
|
|
|
$(this).find('.nav.nav-tabs li').removeClass('has-error');
|
|
|
|
$(this).find('.form-group').removeClass('has-error');
|
|
|
|
$(this).find('span.help-block').remove();
|
|
|
|
};
|
|
|
|
|
2016-08-11 22:05:23 +08:00
|
|
|
$.fn.clearFormFields = function () {
|
2016-07-22 19:29:01 +08:00
|
|
|
$(this).find("input")
|
|
|
|
.not("button")
|
|
|
|
.not('input[type="submit"], input[type="reset"], input[type="hidden"]')
|
|
|
|
.not('input[type="radio"]') // Leave out radios as this messes up Bootstrap btn-groups
|
|
|
|
.val('')
|
|
|
|
.removeAttr('checked')
|
|
|
|
.removeAttr('selected');
|
|
|
|
};
|
|
|
|
|
2016-08-11 22:05:23 +08:00
|
|
|
$.fn.removeBlankFileForms = function () {
|
|
|
|
$(this).find("input[type='file']").each(function () {
|
2016-07-22 19:29:01 +08:00
|
|
|
if (!this.files[0]) {
|
|
|
|
$(this).closest("fieldset").remove();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|