回答編集履歴
1
> iが2つあってそれぞれにイベントをつけたい
test
CHANGED
@@ -14,11 +14,19 @@
|
|
14
14
|
|
15
15
|
const li = document.createElement('li');
|
16
16
|
|
17
|
-
li.innerHTML = "<p class='lankbtn'>●</p>" + newTask
|
17
|
+
li.innerHTML = "<p class='lankbtn'>●</p><span>" + newTask + "</span>" +
|
18
|
+
|
19
|
+
"<i class='far fa-trash-alt gomi'></i><i class='fas fa-edit edi'></i>"; // liの中身だけ
|
18
20
|
|
19
21
|
li.querySelector('p').onclick = console.error
|
20
22
|
|
21
|
-
li.querySelector('i').onclick = console.d
|
23
|
+
li.querySelector('i.gomi').onclick = console.debug
|
24
|
+
|
25
|
+
li.querySelector('i.edi').onclick = function (event) {
|
26
|
+
|
27
|
+
event.target.parentNode.querySelector("span").setAttribute("contenteditable","true")
|
28
|
+
|
29
|
+
}
|
22
30
|
|
23
31
|
lists.insertAdjacentElement("beforeend", li);
|
24
32
|
|