Skip to content

Commit fab0e55

Browse files
committed
button -> span
span 初出だと思うので、button のほうが良ければ revert してください。
1 parent 316b8d1 commit fab0e55

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/1-trial-session/13-dom/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ element.style.backgroundColor = "red";
5353

5454
`document.createElement` 関数は、引数に要素の種類を表す文字列を取り、その種類の新しい HTML 要素を作る関数です。
5555
`document.createElement` 関数の戻り値は、新しく作った HTML 要素に対応するオブジェクトです。
56-
下の例では、新しい `button` 要素を作っています。
56+
下の例では、新しい `span` 要素を作っています。
5757
中身のない空の要素が作成されるので、`textContent``Hello World!` に設定してみましょう。
5858

5959
```js title="script.js"
60-
const newButton = document.createElement("button");
61-
newButton.textContent = "Hello World!";
60+
const newSpan = document.createElement("span");
61+
newSpan.textContent = "Hello World!";
6262
```
6363

6464
そして、`要素1.appendChild(要素2)` とすることで、要素1の子要素に要素2を追加し、画面に表示することができます。
@@ -71,13 +71,13 @@ newButton.textContent = "Hello World!";
7171
```js title="script.js"
7272
const parent = document.getElementById("parent-element");
7373

74-
const newButton = document.createElement("button");
75-
newButton.textContent = "Hello World!";
74+
const newSpan = document.createElement("span");
75+
newSpan.textContent = "Hello World!";
7676

77-
parent.appendChild(newButton);
77+
parent.appendChild(newSpan);
7878
```
7979

80-
これで、既存の `div` 要素の子要素に新しい `button` 要素が追加され、画面に `Hello World!` と書いてあるボタンが表示されます
80+
これで、既存の `div` 要素の子要素に新しい `span` 要素が追加され、画面に `Hello World!` と表示されます
8181

8282
## 初級課題
8383

0 commit comments

Comments
 (0)