回答編集履歴
2
訂正
test
CHANGED
@@ -46,7 +46,9 @@
|
|
46
46
|
|
47
47
|
// 1. select.subbox の操作で値が変わると発火するイベント
|
48
48
|
|
49
|
+
//document.getElementById("cate").addEventListener("cange", function(event){
|
50
|
+
|
49
|
-
document.getElementById("cate").addEventListener("cange", function(event){
|
51
|
+
document.getElementById("cate").addEventListener("change", function(event){
|
50
52
|
|
51
53
|
var elm = event.target; // select#id になる。
|
52
54
|
|
1
追記
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
var dispSubBox = function(subId) {
|
34
34
|
|
35
|
-
[...document.querySelectorAll(".subbox2")].forEach(elm
|
35
|
+
[...document.querySelectorAll(".subbox2")].forEach(function(elm){
|
36
36
|
|
37
37
|
elm.style.display = elm.id===subId ? "inline": "none"
|
38
38
|
|
@@ -68,6 +68,8 @@
|
|
68
68
|
|
69
69
|
MDN
|
70
70
|
|
71
|
+
* [条件(三項)演算](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Conditional_Operator)
|
72
|
+
|
71
73
|
* [Event.target](https://developer.mozilla.org/ja/docs/Web/API/Event/target)
|
72
74
|
|
73
75
|
* [DOcument.querySelectorAll()](https://developer.mozilla.org/ja/docs/Web/API/Document/querySelectorAll)
|