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

質問編集履歴

4

誤字修正

2018/04/17 23:25

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  ## HTMLの構成
13
13
  ```html
14
- <form id="basic_form" method="get" action="----" name="----">
14
+ <form id="basic_form" method="get" action="----" name="basic_search">
15
15
  <input type="text" ~~>
16
16
 
17
17
  <input type="radio" name="--" value="and" >and

3

微修正

2018/04/17 23:25

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -18,9 +18,9 @@
18
18
  <input type="radio" name="--" value="or" >or
19
19
 
20
20
  <div id="checkbox_id">
21
- <input id="checkbox_id1" type="checkbox" name="codeType" value="---" >
21
+ <input type="checkbox" name="codeType" value="---" >
22
- <input id="checkbox_id2" type="checkbox" name="codeType" value="---" >
22
+ <input type="checkbox" name="codeType" value="---" >
23
- <input id="checkbox_id3" type="checkbox" name="codeType" value="---" >
23
+ <input type="checkbox" name="codeType" value="---" >
24
24
  </div>
25
25
  </form>
26
26
  ```

2

修正済み

2018/04/17 23:24

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
 
9
9
  ★すみません、投稿時に少しミスをしているかもしれません。修正中です。
10
+ →修正しました。
10
11
 
11
12
  ## HTMLの構成
12
13
  ```html
@@ -17,28 +18,22 @@
17
18
  <input type="radio" name="--" value="or" >or
18
19
 
19
20
  <div id="checkbox_id">
20
- <input id="checkbox_id1" type="checkbox" name="---" value="---" >
21
+ <input id="checkbox_id1" type="checkbox" name="codeType" value="---" >
21
- <input id="checkbox_id2" type="checkbox" name="---" value="---" >
22
+ <input id="checkbox_id2" type="checkbox" name="codeType" value="---" >
22
- <input id="checkbox_id3" type="checkbox" name="---" value="---" >
23
+ <input id="checkbox_id3" type="checkbox" name="codeType" value="---" >
23
24
  </div>
24
25
  </form>
25
26
  ```
26
27
 
27
28
  ## JS
28
29
  ```js
29
- document.getElementById("checkbox_id").forEach(function(){
30
+ document.forms.basic_search.codeType.forEach(function(){
30
31
  addEventListener("change",function(){
31
32
  document.forms.basic_search.submit();
32
33
  })
34
+ });
33
35
 
34
36
  ```
35
37
 
36
38
  ## 現象
37
- ラジオボタンやその他のテキストボックスを変更しても、submitが実行される。
39
+ ラジオボタンやその他のテキストボックスを変更しても、submitが実行される。
38
-
39
- なお下記のように書いても、同じくsubmitが実行されてしまいました。
40
- ```js
41
- document.getElementById("checkbox_id1").addEventListener("change",function(){
42
- document.forms.basic_search.submit();
43
- });
44
- ```

1

修正

2018/04/17 23:23

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -6,6 +6,7 @@
6
6
  ご指導お願いいたします。
7
7
 
8
8
 
9
+ ★すみません、投稿時に少しミスをしているかもしれません。修正中です。
9
10
 
10
11
  ## HTMLの構成
11
12
  ```html