-
Notifications
You must be signed in to change notification settings - Fork 0
/
TODO.html
49 lines (43 loc) · 937 Bytes
/
TODO.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
49
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>TODO</title>
<style>
body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
}
#input {
margin-bottom: 8pt;
padding: 4pt;
}
#add {
border: 0px solid #0000;
padding: 4pt;
margin-left: 8pt;
}
</style>
<div id="app"></div>
<script src="elite.js"></script>
<script>
const addTask = (e) => {
e.preventDefault();
const task = get('input').value
if (!task) return
input.value = ''
add('list', el({ n: 'p', t: task }))
}
const app = el([
{ n: 'h1', t: 'TODO' },
{
n: 'form', e: { submit: addTask }, c: [
{ n: 'input', a: { id: 'input', type: 'text', placeholder: 'Enter task', required: true, autofocus: true } },
{ n: 'button', t: 'Add', a: { id: 'add', type: 'submit' } },
],
},
{ n: 'div', a: { id: 'list' } },
])
set('app', app)
</script>