-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddItems.js
More file actions
30 lines (25 loc) · 765 Bytes
/
addItems.js
File metadata and controls
30 lines (25 loc) · 765 Bytes
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
function openAddItemPopup(){
let popup = document.querySelector(".add-todo");
popup.classList.add("open-popup");
}
function cancelAddItemPopup(){
let popup = document.querySelector(".add-todo");
popup.classList.remove("open-popup");
}
function closeAddItemPopup(form){
let catSelect = document.getElementById("cat-todo");
let catIndex = catSelect.selectedIndex;
let selectedCategory = catSelect.options[catIndex].value;
List.push({
name: form.name.value,
value: parseInt(form.price.value),
cat: selectedCategory
})
updateList();
cancelAddItemPopup();
stringJSON();
}
function closeNoMoney(){
let popup = document.querySelector(".no-money");
popup.classList.remove("open-popup");
}