質問編集履歴
2
コード修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -45,12 +45,32 @@
|
|
45
45
|
</div><!-- wrapper -->
|
46
46
|
|
47
47
|
<script>
|
48
|
-
|
48
|
+
const lists=document.querySelector("#list");
|
49
|
-
|
49
|
+
const submit=document.querySelector("#submit");
|
50
|
+
async function getData() {
|
51
|
+
event.preventDefault();
|
52
|
+
const response = await fetch('https://jsonplaceholder.typicode.com/todos');
|
53
|
+
const data = await response.json();
|
54
|
+
data.forEach(e=>list.appendChild(Object.assign(document.createElement('li'),{textContent:e.title})));
|
55
|
+
};
|
56
|
+
|
57
|
+
|
58
|
+
window.addEventListener('DOMContentLoaded', async()=>{
|
59
|
+
const data=await fetch('https://jsonplaceholder.typicode.com/todos').then(res=>res.json());
|
60
|
+
//全件
|
61
|
+
const data_all=data.map(x=>x.title);
|
62
|
+
console.log(data_all);
|
63
|
+
//未完了
|
64
|
+
const data_uncompleted=data.filter(x=>!x.completed).map(x=>x.title);
|
65
|
+
console.log(data_uncompleted);
|
66
|
+
//完了
|
67
|
+
const data_completed=data.filter(x=>x.completed).map(x=>x.title);
|
68
|
+
console.log(data_completed);
|
69
|
+
});
|
70
|
+
|
71
|
+
|
50
72
|
const button=document.querySelector('#submit');
|
51
73
|
const ulList=document.querySelector("#list");
|
52
|
-
|
53
|
-
|
54
74
|
button.addEventListener('submit',(lists)=>{
|
55
75
|
const select=document.querySelector('#select');
|
56
76
|
if(select.value===''){
|
@@ -68,37 +88,9 @@
|
|
68
88
|
}});
|
69
89
|
|
70
90
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
const lists=document.querySelector("#list");
|
75
|
-
const submit=document.querySelector("#submit");
|
76
|
-
async function getData() {
|
77
|
-
event.preventDefault();
|
78
|
-
const response = await fetch('https://jsonplaceholder.typicode.com/todos');
|
79
|
-
const data = await response.json();
|
80
|
-
data.forEach(e=>list.appendChild(Object.assign(document.createElement('li'),{textContent:e.title})));
|
81
|
-
|
82
|
-
}
|
83
|
-
window.addEventListener('DOMContentLoaded', async()=>{
|
84
|
-
const data=await fetch('https://jsonplaceholder.typicode.com/todos').then(res=>res.json());
|
85
|
-
//全件
|
86
|
-
const data_all=data.map(x=>x.title);
|
87
|
-
console.log(data_all);
|
88
|
-
|
89
|
-
//未完了
|
90
|
-
const data_uncompleted=data.filter(x=>!x.completed).map(x=>x.title);
|
91
|
-
console.log(data_uncompleted);
|
92
|
-
//完了
|
93
|
-
const data_completed=data.filter(x=>x.completed).map(x=>x.title);
|
94
|
-
console.log(data_completed);
|
95
|
-
});
|
96
|
-
|
97
|
-
|
98
91
|
</script>
|
99
92
|
</body>
|
100
93
|
</html>
|
101
|
-
|
102
94
|
```ここに言語名を入力
|
103
95
|
ソースコード
|
104
96
|
JavaScript
|
1
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -51,7 +51,7 @@
|
|
51
51
|
const ulList=document.querySelector("#list");
|
52
52
|
|
53
53
|
|
54
|
-
button.addEventListener('submit',()=>{
|
54
|
+
button.addEventListener('submit',(lists)=>{
|
55
55
|
const select=document.querySelector('#select');
|
56
56
|
if(select.value===''){
|
57
57
|
const elLi=document.createElement('li');
|