init todo static
This commit is contained in:
parent
8e5454ae70
commit
ead39e714b
29
public/index.html
Normal file
29
public/index.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Todo App</title>
|
||||
<style>
|
||||
body {font-family:Arial,Helvetica,sans-serif; max-width:600px; margin:auto; padding:2rem;}
|
||||
ul {list-style:none; padding:0;}
|
||||
li {margin:0.5rem 0;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Todo</h1>
|
||||
<input id="newTask" placeholder="New task" />
|
||||
<button onclick="addTask()">Add</button>
|
||||
<ul id="list"></ul>
|
||||
<script>
|
||||
function addTask(){
|
||||
const input=document.getElementById('newTask');
|
||||
if(!input.value) return;
|
||||
const li=document.createElement('li');
|
||||
li.textContent=input.value;
|
||||
li.onclick=()=>li.remove();
|
||||
document.getElementById('list').appendChild(li);
|
||||
input.value='';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user