From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../ja/web/api/element/removeattribute/index.html | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 files/ja/web/api/element/removeattribute/index.html (limited to 'files/ja/web/api/element/removeattribute/index.html') diff --git a/files/ja/web/api/element/removeattribute/index.html b/files/ja/web/api/element/removeattribute/index.html new file mode 100644 index 0000000000..750ca4360f --- /dev/null +++ b/files/ja/web/api/element/removeattribute/index.html @@ -0,0 +1,71 @@ +--- +title: Element.removeAttribute() +slug: Web/API/Element/removeAttribute +tags: + - API + - DOM + - Element + - Method + - Reference + - remove + - removeAttribute + - メソッド +translation_of: Web/API/Element/removeAttribute +--- +
{{ APIRef("DOM") }}
+ +

{{domxref("Element")}} の removeAttribute() メソッドは、指定された名前の属性を要素から削除します。

+ +

構文

+ +
element.removeAttribute(attrName);
+
+ +

Parameters

+ +
+
attrName
+
{{domxref("DOMString")}} で、要素から削除する属性の名前を指定します。指定された属性が存在しない場合、 removeAttribute() はエラーを発生させずに戻ります。
+
+ +

返値

+ +

undefined です。

+ +

使用上の注意

+ +

属性の値を直接、または {{domxref("Element.setAttribute", "setAttribute()")}} を使用して null に設定するのではなく、 removeAttribute() を使用してください。多くの属性は null に設定しても、期待通りの動作をしません。

+ +

{{ DOMAttributeMethods() }}

+ +

+ +
// Given: <div id="div1" align="left" width="200px">
+document.getElementById("div1").removeAttribute("align");
+// Now: <div id="div1" width="200px">
+
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('DOM WHATWG', '#dom-element-removeattribute', 'Element" removeAttribute')}}{{Spec2('DOM WHATWG')}}
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.Element.removeAttribute")}}

-- cgit v1.2.3-54-g00ecf