fixed condition in tab script
This commit is contained in:
parent
66fe246f5b
commit
9d8b23ae98
|
@ -12,8 +12,7 @@ function setInputsState(section, disabled = false) {
|
|||
});
|
||||
}
|
||||
|
||||
tabs.forEach((tab) => {
|
||||
tab.addEventListener('hide.bs.tab', event => {
|
||||
function tabSwitchHandler(event) {
|
||||
const id_content_hide = event.target.getAttribute('data-bs-target');
|
||||
const id_content_show = event.relatedTarget.getAttribute('data-bs-target');
|
||||
|
||||
|
@ -23,12 +22,15 @@ tabs.forEach((tab) => {
|
|||
|
||||
// console.log('==== Show ====');
|
||||
const content_show = document.querySelector(id_content_show);
|
||||
setInputsState(content_show);
|
||||
});
|
||||
setInputsState(content_show, false);
|
||||
}
|
||||
|
||||
if (!tab.getAttribute('aria-selected')) {
|
||||
const id_content_hide = tab.getAttribute('data-bs-target');
|
||||
const content_hide = document.querySelector(id_content_hide);
|
||||
tabs.forEach((tab) => {
|
||||
tab.addEventListener('hide.bs.tab', tabSwitchHandler);
|
||||
|
||||
if (tab.getAttribute('aria-selected') == "false") {
|
||||
let id_content_hide = tab.getAttribute('data-bs-target');
|
||||
let content_hide = document.querySelector(id_content_hide);
|
||||
setInputsState(content_hide, true);
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue