added persistance exercice
This commit is contained in:
1 parent
a3872b028e
commit
0fedae6143
2 files changed
+31
No files matched your search
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<input type="text" id="input1"/>
|
||||
<button id="exo1">Ajouter</button>
|
||||
<ul id="list1" >
|
||||
<li>Foo</li>
|
||||
<li>Bar</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script src="main.js" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,8 @@
|
||||
function click(){
|
||||
const value = document.getElementById("input1").value;
|
||||
const li = document.createElement("li");
|
||||
li.innerText = value;
|
||||
document.getElementById("list1").appendChild(li);
|
||||
}
|
||||
|
||||
document.getElementById("exo1").addEventListener("click", click);
|
||||
Reference in new issue
Block a user