-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
41 lines (29 loc) · 1.13 KB
/
scripts.js
File metadata and controls
41 lines (29 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ------- SCRIPT FOR SIDE MENU IN SMALL DEVICE VIEW ------- */
var sidemenu = document.getElementById("sidemenu");
function openmenu(){
sidemenu.style.right = "0";
}
function closemenu(){
sidemenu.style.right = "-200px";
}
/* ------- SCRIPT SHOWING/HIDING ELEMENTS ------- */
function changeDisplay(args){
args.forEach(element => {
let e = document.getElementById(element[0]);
e.style.display = element[1];
});
}
/* ------- SCRIPT FOR SUBMISSION FORM ------- */
const scriptURL = "https://script.google.com/macros/s/AKfycbySnCEqeTVqeLAVK6x6kWmzzrzUh2Aq4jtLVlHTBTFoZUOTKlN_qtD9hk8Hu25_yZVU/exec"
const form = document.forms['submit-to-google-sheet']
const msg = document.getElementById("msg")
form.addEventListener('submit', e =>{
e.preventDefault();
fetch(scriptURL, { method:'POST', body: new FormData(form)})
.then( response=> {
msg.innerHTML = " Message sent successfully "
setTimeout( function(){msg.innerHTML = ""}, 5000)
form.reset()
})
.catch(error => console.error('Error!', error.message))
})