質問編集履歴
1
文法の修正。
title
CHANGED
File without changes
|
body
CHANGED
@@ -49,4 +49,49 @@
|
|
49
49
|
|
50
50
|
</body>
|
51
51
|
</html>
|
52
|
+
```
|
53
|
+
|
54
|
+
h3を定義したところ、以下のエラーが出ました。
|
55
|
+
TypeError: Failed to execute 'insertBefore' on 'Node': parameter 1 is not of type 'Node'.
|
56
|
+
|
57
|
+
「textの部分はNodeじゃないとダメ」という意味だと思うのですが、どう言い換えればいいのかが分かりません。
|
58
|
+
|
59
|
+
```ここに言語を入力
|
60
|
+
<!DOCTYPE html>
|
61
|
+
<html lang="ja">
|
62
|
+
<head>
|
63
|
+
<meta charset="UTF-8">
|
64
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
65
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
66
|
+
<title>ToDoリスト</title>
|
67
|
+
<link rel="stylesheet" href="css/styles.css">
|
68
|
+
</head>
|
69
|
+
<body>
|
70
|
+
<h1>ToDoリスト</h1>
|
71
|
+
<label><input type="radio" name="phone">すべて</label>
|
72
|
+
<label><input type="radio" name="phone" >作業中</label>
|
73
|
+
<label><input type="radio" name="phone">完了中</label>
|
74
|
+
<h3 id="id_h3">IDコメント 状態</h3>
|
75
|
+
<h2>新規タスクの追加</h2>
|
76
|
+
|
77
|
+
<p>
|
78
|
+
<input type="text" id="id_text" value="">
|
79
|
+
<button id="btn" type="btn"> 追加</button>
|
80
|
+
</p>
|
81
|
+
|
82
|
+
|
83
|
+
<script>
|
84
|
+
const btn = document.getElementById('btn');
|
85
|
+
btn.addEventListener('click', () => {
|
86
|
+
const text = document.getElementById('id_text').value;
|
87
|
+
const h3 = document.getElementById('id_h3');
|
88
|
+
|
89
|
+
|
90
|
+
document.body.insertBefore(text, h3);
|
91
|
+
});
|
92
|
+
|
93
|
+
</script>
|
94
|
+
|
95
|
+
</body>
|
96
|
+
</html>
|
52
97
|
```
|