teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

Jqueryのバージョン追加

2016/05/18 18:51

投稿

milkif
milkif

スコア16

title CHANGED
File without changes
body CHANGED
@@ -55,4 +55,5 @@
55
55
 
56
56
  ###補足情報(言語/FW/ツール等のバージョンなど)
57
57
  XAMPP 5.6.14-0
58
- cakephp-2.7.8
58
+ cakephp-2.7.8
59
+ jquery 1.11.0

1

回答例に合わせて修正

2016/05/18 18:51

投稿

milkif
milkif

スコア16

title CHANGED
File without changes
body CHANGED
@@ -21,7 +21,8 @@
21
21
  print_r ($answer);
22
22
  }
23
23
  ?>
24
+ // id="hoge"を追記
24
- <form method="post" action="">
25
+ <form method="post" action="" id="hoge">
25
26
  <input type="checkbox" id="check1" name="answer[]" value="1">チェック1<br>
26
27
  <input type="checkbox" id="check2" name="answer[]" value="2">チェック2<br>
27
28
  <input type="submit" id="submit" value="Submit">
@@ -41,9 +42,9 @@
41
42
  });
42
43
  });
43
44
 
44
- //送信時の制御
45
+ //送信時の制御 $('#submit').click(function()を下記に修正
45
46
  var index = 0;
46
- $('#submit').click(function() {
47
+ $('#hoge').submit(function() {
47
48
  index++;
48
49
  console.log(index);
49
50
  });