forked from mrlaboratory/the-best-blogger-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
localstorage.html
47 lines (41 loc) · 1015 Bytes
/
localstorage.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
<!DOCTYPE html>
<html>
<head>
<title>Local storage</title>
</head>
<body>
<button onclick="add()">Add</button>
<button onclick="remove()">Remove</button>
<button onclick="nonee()">None</button>
<button onclick="clearr()">Clear</button>
<button onclick="showss()">show name</button>
<h2 id="mr">000</h2>
<script>
function add(){
localStorage.setItem("name", "Mijan");
}
function remove(){
localStorage.removeItem("name", "none");
}
function clearr(){
localStorage.clearr()
}
function showss(){
document.getElementById("mr").innerHTML = localStorage.getItem("name");
}
function nonee(){
localStorage.removeItem("name");
}
localStorage.setItem('key', 'value')
const form = document.querySelector('form')
const ul = document.querySelector('ul')
const button = document.querySelector('button')
const input = document.getElementById('item')
// setItem()
// getItem()
// removeItem()
// clear()
// https://www.taniarascia.com/how-to-use-local-storage-with-javascript/
</script>
</body>
</html>