-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
80 lines (72 loc) · 2.73 KB
/
index.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Todo list</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
</head>
<body>
<header>
<div class="wrapper clearfix">
<h1>To-Do List Project</h1>
<h2>I'm making this to learn javascript and SASS.</h2>
</div>
</header>
<div id="main" class="wrapper clearfix">
<section id="content">
<h3>To-Do List</h3>
<ul id="outline">
</ul>
</section>
<aside>
<form>
<input type="text" name="project" class="todo-input" placeholder="project name" autofocus />
</input>
<input type="text" name="task" class="todo-input" placeholder="task" autofocus />
</input>
<textarea name="details" class="todo-input" placeholder="more details" cols="30" rows="5"></textarea>
<label for="due">due date:</label><input id="due" type="date" name="date" value="2012-08-19"/>
</input>
<button id="submit">add task</button>
</form>
<script type="text/javascript">
$("#submit").click(function () {
var projectName = $('input[name=project]').val();
var taskName = $('input[name=task]').val();
var details = $('textarea[name=details]').val();
var dueDate = $('input[name=date]').val();
var listItem1 = "<li><span>project:</span>" + projectName + "</li>";
var listItem2 = "<li><span>task:</span>" + taskName + "</li>";
var listItem3 = "<li><span>more details:</span>" + details + "</li>";
var listItem4 = "<li>" + dueDate + "</li>";
getProjectContainer(projectName);
var projectContainer = $("<div class='projectContainer'></div>");
projectContainer.data('pName', projectName);
projectContainer.append(listItem1);
projectContainer.append(listItem2);
projectContainer.append(listItem3);
projectContainer.append(listItem4);
$('#outline').append(projectContainer);
$('.todo-input').val('');
return false;
});
// this function is going to check if the project has been created yet or not
// if it has not been created a new one will be created
// for each div inside #outline it will check if the project exists
function getProjectContainer(projectName){
$('#outline div').each(function(index) {
var div = $(this);
var thisName = div.data('pName');
console.log("This project is", thisName);
});
}
</script>
</aside>
</div>
</body>
</html>