回答編集履歴
1
コメントを受けて追記
answer
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
要は、jQueryの使い方を知りたい、ということでいいでしょうか?
|
2
|
-
`fetch('https://teratail.com').then(res => res.text()).then(txt => console.log($("div
|
2
|
+
`fetch('https://teratail.com').then(res => res.text()).then(txt => console.log($("div.classname > a", txt)));`
|
3
3
|
|
4
4
|
参考:[jQuery() | jQuery API Documentation](http://api.jquery.com/jQuery/#jQuery-selector-context)
|
5
5
|
|
6
6
|
|
7
7
|
|
8
|
-
言うまでもなく、実行するページにjQueryが読み込まれている前提です。
|
8
|
+
言うまでもなく、実行するページにjQueryが読み込まれている前提です。
|
9
|
+
|
10
|
+
### コメントを受けて追記
|
11
|
+
`fetch('https://teratail.com').then(res => res.text()).then(txt => console.log($("div.classname > a", txt)[0]));`
|
12
|
+
|
13
|
+
参考:
|
14
|
+
> 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].
|
15
|
+
[Types | jQuery API Documentation](http://api.jquery.com/Types/#jQuery)
|