11
8

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】IEで取得した要素を削除する

11
Last updated at Posted at 2018-08-02

IEで.remove()が未対応なので、
IEでも動作するように.parentNodeを使って要素を削除。

script.js
$elm = document.getElementById(elm);

// IE未対応
$elm.remove();

// IE対応
$elm.parentNode.removeChild(elm);
11
8
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
11
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?