回答編集履歴

3

リンクがallになっていなかったので修正。

2017/10/05 01:19

投稿

masaya_ohashi
masaya_ohashi

スコア9206

test CHANGED
@@ -1,6 +1,6 @@
1
1
  `document.querySelectorAll`を使えば一発です。cssのセレクタ記法と同様の書き方で、elementのリストが取得できます。
2
2
 
3
- [https://developer.mozilla.org/ja/docs/Web/API/Document/querySelector](https://developer.mozilla.org/ja/docs/Web/API/Document/querySelector)
3
+ [https://developer.mozilla.org/ja/docs/Web/API/Document/querySelectorAll](https://developer.mozilla.org/ja/docs/Web/API/Document/querySelectorAll)
4
4
 
5
5
 
6
6
 

2

querySelectorでは1個しか取れないのでAllに変更

2017/10/05 01:19

投稿

masaya_ohashi
masaya_ohashi

スコア9206

test CHANGED
@@ -1,4 +1,4 @@
1
- `document.querySelector`を使えば一発です。cssのセレクタ記法と同様の書き方で、elementのリストが取得できます。
1
+ `document.querySelectorAll`を使えば一発です。cssのセレクタ記法と同様の書き方で、elementのリストが取得できます。
2
2
 
3
3
  [https://developer.mozilla.org/ja/docs/Web/API/Document/querySelector](https://developer.mozilla.org/ja/docs/Web/API/Document/querySelector)
4
4
 
@@ -6,6 +6,6 @@
6
6
 
7
7
  ```javascript
8
8
 
9
- var touchList = document.querySelector("#application li img");
9
+ var touchList = document.querySelectorAll("#application li img");
10
10
 
11
11
  ```

1

コードブロックに言語表記を追加。

2017/10/05 01:18

投稿

masaya_ohashi
masaya_ohashi

スコア9206

test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- ```
7
+ ```javascript
8
8
 
9
9
  var touchList = document.querySelector("#application li img");
10
10