回答編集履歴
2
追記
test
CHANGED
@@ -2,9 +2,34 @@
|
|
2
2
|
構造が正しく評価されるかどうかは運次第です
|
3
3
|
|
4
4
|
ちなみに直下の子供は「> *」 なので孫は「> * > *」です
|
5
|
+
(HTML部分も追記しました)
|
5
6
|
```javascript
|
7
|
+
<script>
|
6
8
|
window.addEventListener('DOMContentLoaded', ()=>{
|
7
9
|
const ids=[...document.querySelectorAll('#bodyRight > * > *')].filter(x=>x.id).map(x=>x.id);
|
8
|
-
console.log(ids);
|
10
|
+
console.log(ids); // [ tableBodyRight1 ]
|
9
11
|
});
|
12
|
+
</script>
|
13
|
+
<div id="bodyRight">
|
14
|
+
<div id="pageRight1">
|
15
|
+
<div id="tableBodyRight1">
|
16
|
+
<tr>...</tr>
|
17
|
+
<tr id="rightRow1_0">
|
18
|
+
<td>A0</td>
|
19
|
+
<td>B0</td>
|
20
|
+
<td>C0</td>
|
21
|
+
</tr>
|
22
|
+
<tr id="rightRow1_1">
|
23
|
+
<td>A1</td>
|
24
|
+
<td>B1</td>
|
25
|
+
<td>C1</td>
|
26
|
+
</tr>
|
27
|
+
<tr id="rightRow1_2">
|
28
|
+
<td>A2</td>
|
29
|
+
<td>B2</td>
|
30
|
+
<td>C2</td>
|
31
|
+
</tr>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
10
35
|
```
|
1
調整
test
CHANGED
@@ -1,2 +1,10 @@
|
|
1
1
|
「id="pageRight1」や「id="tableBodyRight1」などクォートの付け忘れなどひどい状態なので
|
2
2
|
構造が正しく評価されるかどうかは運次第です
|
3
|
+
|
4
|
+
ちなみに直下の子供は「> *」 なので孫は「> * > *」です
|
5
|
+
```javascript
|
6
|
+
window.addEventListener('DOMContentLoaded', ()=>{
|
7
|
+
const ids=[...document.querySelectorAll('#bodyRight > * > *')].filter(x=>x.id).map(x=>x.id);
|
8
|
+
console.log(ids);
|
9
|
+
});
|
10
|
+
```
|