-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
58 lines (28 loc) · 1.03 KB
/
script.js
File metadata and controls
58 lines (28 loc) · 1.03 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//add local time/ date
var today = moment()
setInterval(() => {
var time= moment().format("MMM Do, YYYY HH:mm:ss ")
$("#time").text(time)
}, 1000)
// change row colors.run a loop thru the today function, and everytime the time changes change the color of the row using the ID"ROW" TO CHANGE THE TABLE ACTIVE CLASS. WITH AND IF STATEMENT.
var hour= moment().format()
$('tr.table-active').each(function(){
var data = $(this).find('th').html()
var dataNumber = parseInt(data)
var hour = moment().format('HH')
var hourNumber = parseInt(hour)
if(hourNumber > dataNumber){
$(this).css("background", "red")
}
else
$(this).css("background", "green")
})
// add to localstorage
function save(text){
localStorage.setItem(text.id, text.value)
}
// retrieve from localstorage. need different for loop in the localstorage
for( var key in localStorage){
var htmlelement= document.getElementById(key)
htmlelement.value= localStorage.getItem(key)
}