diff --git a/week-2/firestore.html b/week-2/firestore.html
new file mode 100644
index 0000000..a37f4c9
--- /dev/null
+++ b/week-2/firestore.html
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+ My Shopping List App
+
+
+
+ My Shopping List App
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week-2/index.html b/week-2/index.html
index 941fa3e..a37f4c9 100644
--- a/week-2/index.html
+++ b/week-2/index.html
@@ -19,6 +19,10 @@
padding: .5em 0;
}
+ #shopping-list span{
+
+ }
+
input:checked + span{
text-decoration: line-through;
}
@@ -38,7 +42,8 @@ My Shopping List App
const addBTn = document.getElementById('add');
const inputBox = document.getElementById('item');
const list = document.getElementById('shopping-list');
- let allItems =['Milk','Eggs', 'Bacon', 'Aloe Vera Stalks'];
+ const keyName = 'shopping-items';
+ let allItems = JSON.parse(localStorage.getItem(keyName) );
addBTn.addEventListener('click', addItem);
@@ -72,6 +77,9 @@ My Shopping List App
a.href = "";
a.addEventListener('click',function(event){
this.parentNode.remove();
+ //Save all Items
+ let allItems = getAllItems();
+ localStorage.setItem(keyName, JSON.stringify(allItems));
event.preventDefault();
});
@@ -88,14 +96,15 @@ My Shopping List App
inputBox.value = "";
inputBox.focus();
- const tags = document.querySelectorAll(".spanyo");
- console.log(tags);
- allItems.forEach(span => console.log());
- console.log(span.innerText);
-
+
+ //const tags = document.querySelectorAll(".spanyo");
+ //console.log(tags);
+
+ //allItems.forEach(span => console.log());
+ //console.log(span.innerText);
-
+
//Queryselecterall - log text
//span.innertext
// document.queryselectorall
@@ -103,6 +112,15 @@ My Shopping List App
};
+ function getAllItems(){
+ let items = document.querySelectorAll('.spanyo');
+ let itemsArray = [];
+ items.forEach(item => {
+ itemsArray.push(item.innerText);
+ })
+ return itemsArray;
+ }
+