-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
22 lines (19 loc) · 726 Bytes
/
Copy pathscript.js
File metadata and controls
22 lines (19 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
let toastBox = document.getElementById("toastBox");
let successMsg = "<i class='fa-solid fa-circle-check'></i> Successfully submitted";
let errorMsg = "<i class='fa-solid fa-circle-xmark'></i> Please fix the error";
let invalidMsg = "<i class='fa-solid fa-circle-exclamation'></i> Invalid input, check again";
function showToast(msg) {
let toast = document.createElement("div");
toast.classList.add("toast");
toast.innerHTML = msg;
toastBox.appendChild(toast);
if (msg.includes("error")) {
toast.classList.add("error");
}
if (msg.includes("Invalid")) {
toast.classList.add("invalid");
}
setTimeout(function(){
toast.remove();
},6000);
}