回答編集履歴
1
テキスト修正
test
CHANGED
@@ -31,3 +31,29 @@
|
|
31
31
|
|
32
32
|
|
33
33
|
[https://jsfiddle.net/jun68ykt/b19mr5n6/3/](https://jsfiddle.net/jun68ykt/b19mr5n6/3/)
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
または、`forEach`で回すなら
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
```javascript
|
42
|
+
|
43
|
+
[].forEach.call(document.getElementsByClassName('range'), (node, i) => {
|
44
|
+
|
45
|
+
node.addEventListener('input', e => {
|
46
|
+
|
47
|
+
const valueSpan = document.getElementById(`value${i+1}`);
|
48
|
+
|
49
|
+
valueSpan.innerHTML = e.target.value;
|
50
|
+
|
51
|
+
});
|
52
|
+
|
53
|
+
});
|
54
|
+
|
55
|
+
```
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
サンプル: [https://jsfiddle.net/jun68ykt/b19mr5n6/4/](https://jsfiddle.net/jun68ykt/b19mr5n6/4/)
|