質問編集履歴
3
誤記訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,13 +28,21 @@
|
|
28
28
|
|
29
29
|
<script>
|
30
30
|
|
31
|
-
document.querySelector('#hoge-list > li')
|
31
|
+
const _li = document.querySelector('#hoge-list > li')
|
32
|
+
|
33
|
+
for(i = 0;i < _li.length;++i) {
|
34
|
+
|
35
|
+
_li[i].addEventListener(() => {
|
32
36
|
|
33
37
|
const _id = this.target.getAttribute('data-hogehoge');
|
34
38
|
|
35
39
|
/* _idを使って非同期処理して画面表示の処理を書く */
|
36
40
|
|
37
41
|
});
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
}
|
38
46
|
|
39
47
|
</script>
|
40
48
|
|
2
コード記述ミス訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
<script>
|
30
30
|
|
31
|
-
document.
|
31
|
+
document.querySelector('#hoge-list > li').addEventListener(() => {
|
32
32
|
|
33
33
|
const _id = this.target.getAttribute('data-hogehoge');
|
34
34
|
|
1
コード例追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,4 +12,34 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
+
```
|
16
|
+
|
17
|
+
<ul id='hoge-list'>
|
18
|
+
|
19
|
+
<li data-hogehoge='1'>aaaa</li>
|
20
|
+
|
21
|
+
<li data-hogehoge='2'>bbbb</li>
|
22
|
+
|
23
|
+
<li data-hogehoge='3'>cccc</li>
|
24
|
+
|
25
|
+
</ul>
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
<script>
|
30
|
+
|
31
|
+
document.getElementById('hoge-list').addEventListener(() => {
|
32
|
+
|
33
|
+
const _id = this.target.getAttribute('data-hogehoge');
|
34
|
+
|
35
|
+
/* _idを使って非同期処理して画面表示の処理を書く */
|
36
|
+
|
37
|
+
});
|
38
|
+
|
39
|
+
</script>
|
40
|
+
|
41
|
+
```
|
42
|
+
|
43
|
+
|
44
|
+
|
15
45
|
その場合、各一覧にレコードキーをどの様に保持しますか?
|