Makes company 1099 page work better and faster
This commit is contained in:
16
resources/public/js/htmx-disable.js
Normal file
16
resources/public/js/htmx-disable.js
Normal file
@@ -0,0 +1,16 @@
|
||||
htmx.defineExtension('disable-submit', {
|
||||
onEvent: function (name, evt, data) {
|
||||
let elt = evt.detail.elt;
|
||||
let result = elt.querySelectorAll('.hx-disable');
|
||||
|
||||
if (name === 'htmx:beforeRequest') {
|
||||
result.forEach(element => element.disabled = true);
|
||||
if (elt.classList.contains('hx-disable')) {
|
||||
elt.disabled = true;}
|
||||
|
||||
} else if(name == 'htmx:afterRequest') {
|
||||
result.forEach(element => element.disabled = false);
|
||||
if (elt.classList.contains('hx-disable')) elt.disabled = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user