回答編集履歴

2

コード調整

2018/04/11 01:03

投稿

defghi1977
defghi1977

スコア4756

test CHANGED
@@ -4,6 +4,6 @@
4
4
 
5
5
  ```JavaScript
6
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);
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

コードを追加

2018/04/11 01:03

投稿

defghi1977
defghi1977

スコア4756

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
+ ```