-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo.html
47 lines (41 loc) · 1.1 KB
/
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
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ToDos</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//Add task to list
$('#addButton').click(function(){
var addValue = $('input[name=addItem]').val();
$('#todoList').append("<tr><td class='itemRow' style='width:20px'><input type='checkBox' class='checkBox'></td><td>" + addValue + "</td></tr>");
});
//Remove task from click
$(document).on('click', '.checkBox', function(){
$(this).closest('tr').remove();
});
});
</script>
<style type="text/css">
a#addButton {
display:inline-block;
padding:4px 10px;
text-decoration:none;
color:#fff;
background-color:blue;
}
a#add:hover {color:#000; background-color:cyan}
</style>
</head>
<body>
<h2>To Dos</h2>
<form name="addItem" >
<input id="addItem" name="addItem" type="text">
<a href="#" id="addButton">Add</a>
</form>
<br>
<table width="40%" border="0" cellpadding="4" cellspacing="0" id="todoList">
</table>
</body>
</html>