Toggle form

This commit is contained in:
ekzyis 2023-09-09 22:52:50 +02:00
parent ce4c495052
commit 58901e8d7e
1 changed files with 19 additions and 8 deletions

View File

@ -29,23 +29,34 @@ function resetInputs() {
noCostDisplay.value = undefined noCostDisplay.value = undefined
} }
function showYesForm() { function toggleYesForm() {
resetInputs() resetInputs()
yesOrderBtn.classList.add("selected") if (yesOrderBtn.classList.contains("selected")) {
yesForm.style.display = "grid" yesOrderBtn.classList.remove("selected")
yesForm.style.display = "none"
}
else {
yesOrderBtn.classList.add("selected")
yesForm.style.display = "grid"
}
noOrderBtn.classList.remove("selected") noOrderBtn.classList.remove("selected")
noForm.style.display = "none" noForm.style.display = "none"
} }
yesOrderBtn.onclick = showYesForm yesOrderBtn.onclick = toggleYesForm
function showNoForm() { function toggleNoForm() {
resetInputs() resetInputs()
noOrderBtn.classList.add("selected") if (noOrderBtn.classList.contains("selected")) {
noForm.style.display = "grid" noOrderBtn.classList.remove("selected")
noForm.style.display = "none"
} else {
noOrderBtn.classList.add("selected")
noForm.style.display = "grid"
}
yesOrderBtn.classList.remove("selected") yesOrderBtn.classList.remove("selected")
yesForm.style.display = "none" yesForm.style.display = "none"
} }
noOrderBtn.onclick = showNoForm noOrderBtn.onclick = toggleNoForm
function showBuyForm() { function showBuyForm() {
resetInputs() resetInputs()