LoginSignup
11
8

More than 3 years have passed since last update.

【JavaScript】IEで取得した要素を削除する

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