-
Notifications
You must be signed in to change notification settings - Fork 0
/
practice.html
48 lines (35 loc) · 891 Bytes
/
practice.html
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
<!doctype html>
<html lang="en">
<head>
<title>Practice</title>
<meta charset="utf-8">
<style>
</style>
</head>
<body onload = "load()">
<div>wowow</div>
<button class= save>save work</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
$(".save").on("click", function(event) {
event.preventDefault();
var fieldValue = "wowomg"//$("body").html;
console.log(fieldValue);
localStorage.setItem("item1", fieldValue);
console.log(localStorage);
console.log("saved work");
}
)
var load = function() {
console.log("attempting load....")
if (storedValue) {
var storedValue = localStorage.getItem("item1");
console.log(storedValue);
$("body").html(storedValue);
console.log("found file. load successful");
return;
}
console.log("nothing is in storage");
}
</script>
</body>