回答編集履歴

1

コメントを受けて追記

2018/01/19 05:14

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア36115

test CHANGED
@@ -1,6 +1,6 @@
1
1
  要は、jQueryの使い方を知りたい、ということでいいでしょうか?
2
2
 
3
- `fetch('https://teratail.com').then(res => res.text()).then(txt => console.log($("div .classname> a", txt)));`
3
+ `fetch('https://teratail.com').then(res => res.text()).then(txt => console.log($("div.classname > a", txt)));`
4
4
 
5
5
   
6
6
 
@@ -13,3 +13,17 @@
13
13
   
14
14
 
15
15
  言うまでもなく、実行するページにjQueryが読み込まれている前提です。
16
+
17
+
18
+
19
+ ### コメントを受けて追記
20
+
21
+ `fetch('https://teratail.com').then(res => res.text()).then(txt => console.log($("div.classname > a", txt)[0]));`
22
+
23
+
24
+
25
+ 参考:
26
+
27
+ > The jQuery object itself behaves much like an array; it has a length property and the elements in the object can be accessed by their numeric indices [0] to [length-1].
28
+
29
+ [Types | jQuery API Documentation](http://api.jquery.com/Types/#jQuery)