回答編集履歴
2
コード調整
test
CHANGED
@@ -4,6 +4,6 @@
|
|
4
4
|
|
5
5
|
```JavaScript
|
6
6
|
|
7
|
-
table.onclick = e => (t => t.type == "button"
|
7
|
+
table.onclick = e => (t => t.type == "button" && [].forEach.call(t.closest("tr").childNodes, el => el.querySelector("input") || console.log(el.textContent)))(e.target);
|
8
8
|
|
9
9
|
```
|
1
コードを追加
test
CHANGED
@@ -1 +1,9 @@
|
|
1
1
|
テーブルタグでクリックイベントをリッスンし,イベントをキャッチしたらそのターゲットのクローセストテーブルロウを取得した後, そのチャイルドノードを取得すれば可能です.
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
```JavaScript
|
6
|
+
|
7
|
+
table.onclick = e => (t => t.type == "button" ? [].forEach.call(t.closest("tr").childNodes, el => el.querySelector("input") ? null: console.log(el.textContent)) : null)(e.target);
|
8
|
+
|
9
|
+
```
|