Element: removeAttributeNS() メソッド

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

removeAttributeNS()Element インターフェイスのメソッドで、要素から指定された属性を取り除きます。

構文

js
removeAttributeNS(namespace, attrName)

引数

  • namespace は文字列で、属性の名前空間を示します。
  • attrName は文字列で、現在のノードから取り除く属性の名前を示します。

返値

なし (undefined)。

js
// Given:
//   <div id="div1" xmlns:special="http://www.mozilla.org/ns/specialspace"
//     special:specialAlign="utterleft" width="200px" />
d = document.getElementById("div1");
d.removeAttributeNS("http://www.mozilla.org/ns/specialspace", "specialAlign");
// Now: <div id="div1" width="200px" />

仕様書

Specification
DOM
# ref-for-dom-element-removeattributens①

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
removeAttributeNS

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Firefox 3 以降では、このメソッドは DOM 値を既定値にリセットします。