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('')
|
2023-08-09 16:33:58 +08:00
|
|
|
.attr('checked', false)
|
|
|
|
.attr('selected', false);
|
2016-07-22 19:29:01 +08:00
|
|
|
};
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|