Skip to content

Commit

Permalink
BUGFIX: modalFooter removed only if it exists in fancyAlert()
Browse files Browse the repository at this point in the history
  • Loading branch information
umbe1987 committed Jan 2, 2019
1 parent 93553b9 commit e1c93bd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/fancy_alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export function fancyAlert(content, alertType, headerText = 'Error', footer = fa
// finally remove header content/classes (otherwise next time the old ones still persist)
modalHeader[0].classList.remove("error-color");
modalHeader[0].classList.remove("info-color");
modalFooter[0].removeChild(footer);
if (footer) {
modalFooter[0].removeChild(footer);
}
}
// When the user clicks anywhere outside of the modal, close it
window.addEventListener('click', function(event) {
Expand All @@ -52,7 +54,9 @@ export function fancyAlert(content, alertType, headerText = 'Error', footer = fa
// finally remove header content/classes (otherwise next time the old ones still persist)
modalHeader[0].classList.remove("error-color");
modalHeader[0].classList.remove("info-color");
modalFooter[0].removeChild(footer);
if (footer) {
modalFooter[0].removeChild(footer);
}
}
});
}
Expand Down

0 comments on commit e1c93bd

Please sign in to comment.