Created
April 9, 2022 22:16
-
-
Save TheGarkine/e26d87290634d1f63c994b58fb1d95ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const form = document.getElementById("contactForm"); | |
| if (request.status === 200) { | |
| // Freeze the form | |
| document.getElementById("contactEmail").readOnly = true; | |
| document.getElementById("contactMessage").readOnly = true; | |
| document.getElementById("contactSubmit").disabled = true; | |
| // Append a thank you message | |
| const span = document.createElement("span"); | |
| span.innerHTML = "Thank you for your message!" | |
| span.style.color="green"; | |
| form.appendChild(span); | |
| } else { | |
| // Append an error message | |
| const span = document.createElement("span"); | |
| span.innerHTML = "An error occured please try again later!" | |
| span.style.color="red"; | |
| form.appendChild(span); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment