recommendation.ejs
2.35 KB
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
81
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="/../style.css">
<title>Test</title>
</head>
<body>
<h1><a href="/food">점심 메뉴 정하기</a></h1>
<div class="grid">
<ul>
<il><a href="/food/search">검색</a></il><br>
<il><a href="/food/recommendation">추천</a></il>
</ul>
<article>
<h2>
<%= title %>
</h2>
<p><%= description %></p>
<button id='check_all'>모두 선택</button>
<button id='uncheck_all'>모두 해제</button>
<button id='count_check'>체크 수 확인</button>
<form action='/food/recommendation' method='post'>
<p>
가격 :
<input type="number" name="price" placeholder="price">
</p>
<p>
<input type="checkbox" name="shape" value="밥">밥</input>
<input type="checkbox" name="shape" value="면">면</input>
<input type="checkbox" name="shape" value="고기">고기</input>
<input type="checkbox" name="shape" value="기타">기타</input>
</p>
<p>
<input type="checkbox" name="kinds" value="한식">한식</input>
<input type="checkbox" name="kinds" value="중식">중식</input>
<input type="checkbox" name="kinds" value="양식">양식</input>
<input type="checkbox" name="kinds" value="일식">일식</input>
</p>
<p>
<input type="submit">
</p>
</form>
<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$("#check_all").click(function() {
$("input[name=kinds]:checkbox").prop("checked", "checked");
});
$("#uncheck_all").click(function() {
$("input[name=kinds]:checkbox").removeProp("checked");
});
$("#count_check").click(function() {
alert($("input[name=kinds]:checkbox:checked").length);
});
$("#check_all").click(function() {
$("input[name=shape]:checkbox").prop("checked", "checked");
});
$("#uncheck_all").click(function() {
$("input[name=shape]:checkbox").removeProp("checked");
});
$("#count_check").click(function() {
alert($("input[name=shape]:checkbox:checked").length);
});
</script>
</article>
</div class="grid">
</body>
</html>