-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocalStorageLevel3.js
44 lines (37 loc) · 946 Bytes
/
localStorageLevel3.js
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
42
43
44
// name buttons start
const getInputValueById = (id) => {
const inputField = document.getElementById(id);
const inputValue = inputField.value;
return inputValue;
};
const saveName = () => {
const name = getInputValueById("nameField");
localStorage.setItem("name", name);
};
const deleteName = () => {
localStorage.removeItem("name");
};
// name buttons end
// email buttons start
const saveEmail = () => {
const email = getInputValueById("emailField");
localStorage.setItem("email", email);
};
const deleteEmail = () => {
localStorage.removeItem("email");
};
// email buttons end
// message buttons start
const saveMessage = () => {
const message = getInputValueById("messageField");
localStorage.setItem("message", message);
};
const deleteMessage = () => {
localStorage.removeItem("message");
};
// message buttons end
// reset button start
const resetAll = () => {
localStorage.clear();
};
// reset button end