質問編集履歴

2

javaScriptが抜けていたので追記しました。(すみません!)

2019/07/17 08:02

投稿

witoiw
witoiw

スコア17

test CHANGED
File without changes
test CHANGED
@@ -188,8 +188,6 @@
188
188
 
189
189
 
190
190
 
191
-
192
-
193
191
  </body>
194
192
 
195
193
  </html>

1

javaScriptが抜けていたので追記しました。(すみません!)

2019/07/17 08:02

投稿

witoiw
witoiw

スコア17

test CHANGED
File without changes
test CHANGED
@@ -34,6 +34,78 @@
34
34
 
35
35
  ```ここに言語名を入力
36
36
 
37
+ <!doctype html>
38
+
39
+ <html>
40
+
41
+ <head>
42
+
43
+ <meta charset="UTF-8">
44
+
45
+ <title>無題/title>
46
+
47
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
48
+
49
+ <script type="text/javascript">
50
+
51
+ jQuery(function($){
52
+
53
+ $(function(){
54
+
55
+ var items = $("form").find('.rq').length;
56
+
57
+ $(".items").html(items);
58
+
59
+ var i = 0;
60
+
61
+ $(".number").html(items - i);
62
+
63
+ $("form").find('.rq').change(function() {
64
+
65
+ calc();
66
+
67
+ });
68
+
69
+ $("form").find('.rq').keyup(function() {
70
+
71
+ calc();
72
+
73
+ });
74
+
75
+ var calc = function() {
76
+
77
+ i = 0;
78
+
79
+ $("form").find('.rq').each(function() {
80
+
81
+ if($(this).val() !== "") {
82
+
83
+ i++;
84
+
85
+ }
86
+
87
+ });
88
+
89
+ $(".number").html(items - i);
90
+
91
+ };
92
+
93
+ });
94
+
95
+ });
96
+
97
+ </script>
98
+
99
+ </head>
100
+
101
+
102
+
103
+ <body>
104
+
105
+
106
+
107
+
108
+
37
109
  <div class="form_inner">
38
110
 
39
111
  <form method="post" action="">
@@ -50,17 +122,17 @@
50
122
 
51
123
  <th>
52
124
 
53
- お問い合わせ種類(複数選択可)<span class="required">必須</span>
125
+ お問い合わせ種類<span class="required">必須</span>
54
126
 
55
127
  </th>
56
128
 
57
129
  <td>
58
130
 
59
- <label><input name="お問い合わせ種類" value="見積り請求" type="checkbox">見積り請求</label><br>
131
+ <label><input name="お問い合わせ種類" value="見積り請求" type="checkbox" class="rq">見積り請求</label><br>
60
132
 
61
- <label><input name="お問い合わせ種類" value="カタログ請求" type="checkbox">カタログ請求</label><br>
133
+ <label><input name="お問い合わせ種類" value="カタログ請求" type="checkbox" class="rq">カタログ請求</label><br>
62
134
 
63
- <label><input name="お問い合わせ種類" value="製品・サービスに関するお問い合せ" type="checkbox">製品・サービスに関するお問い合せ</label>
135
+ <label><input name="お問い合わせ種類" value="製品・サービスに関するお問い合せ" type="checkbox" class="rq">製品・サービスに関するお問い合せ</label>
64
136
 
65
137
  </td>
66
138
 
@@ -92,7 +164,7 @@
92
164
 
93
165
  </th>
94
166
 
95
- <td class="form_required">
167
+ <td>
96
168
 
97
169
  <textarea type="text" name="" /></textarea>
98
170
 
@@ -112,4 +184,16 @@
112
184
 
113
185
  </div>
114
186
 
187
+
188
+
189
+
190
+
191
+
192
+
193
+ </body>
194
+
195
+ </html>
196
+
197
+
198
+
115
199
  ```