2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JavaScriptで新しいHTML要素を追加

Last updated at Posted at 2018-08-02

##JavaScriptでHTML要素を作ります
#まず、要素を作りたい場所をidで取得しておきます。

script.js
TimeLine = document.getElementById("timeline");

#以下コード

script2.js
//タグの種類を設定し、新しい要素を作る
newElement = document.createElement("div");
//「この間に、作った要素に付けたい属性を記述する
newElement.innerHTML = "done";
//」
//作った要素を最初に指定した場所に配置
TimeLine.appendChild(newElement);
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?