-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
41 lines (34 loc) · 1.16 KB
/
script.js
File metadata and controls
41 lines (34 loc) · 1.16 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
function time() {
var momentCurrentDate = moment().format("MMMM Do YYYY h:mm:ss a");
$("#currentDay").text(momentCurrentDate);
}
//created set interval method to run the time function to update time every 1000 miliseconds
time();
setInterval(time, 1000);
const keys = Object.entries(localStorage);
keys.forEach(function(key) {
$("#" + key[0]).val(key[1]);
});
//locate button that is responsible for saving the note
$('.saveBtn').on('click', function ()
{ console.log('the button was clicked');
var className = $(this).val();
var inputId = $("#" + className);
var value = inputId.val();
console.log(value);
localStorage.setItem(className, value)
console.log(className);
});
function loadNotes() {
var noteInputFields = $('note-field');
for (var i = 0; i < noteInputFields.length; i++) {
for (var j = 0; j < notes.length; j++) {
if (noteInputFields[i].hasClass(notes[j].timeslot)) {
noteInputfields[i].val(notes[j].note);
break;
}
}
}
}
//define a click listener that will execute some funcion that will save the note
//use local storage to save the note