murph-skeleton/assets/js/admin/modules/form.js

32 lines
720 B
JavaScript
Raw Normal View History

2021-03-24 12:27:07 +01:00
const $ = require('jquery');
module.exports = function() {
2021-06-15 11:31:52 +02:00
$('body').on('change', '.custom-file-input', function(event) {
2021-03-24 12:27:07 +01:00
let inputFile = event.currentTarget;
$(inputFile).parent()
.find('.custom-file-label')
.html(inputFile.files[0].name);
});
$('.nav a').each(function() {
const link = $(this)
const href = link.attr('href')
if (href.substr(0, 1) !== '#') {
return
}
const tab = $('.tab-pane ' + href)
if (!tab.length) {
return
}
if (tab.find('.form-error-message').length) {
link.addClass('border border-danger')
link.click()
}
})
2021-03-24 12:27:07 +01:00
};