HTML DOM removeAttribute()メソッド

元素对象参考手册要素オブジェクト

例

ヘッダー要素の style 属性を削除:

document.getElementsByTagName("H1")[0].removeAttribute("style");

属性を削除する前:

Hello World

属性を削除した後:

Hello World


試してみる »

定義と用法

removeAttribute() メソッドは指定された属性を削除します

類似のメソッドを表示 removeAttributeNode() 。


ブラウザサポート

Internet ExplorerFirefoxOperaGoogle ChromeSafari

すべての主要ブラウザは removeAttribute() メソッドをサポートしています


構文

element.removeAttribute(attributename)

パラメータ

パラメータ 型 説明
attributename String 必須。削除する属性の名前を指定します。

戻り値

戻り値はありません。

技術詳細

DOM バージョン Core Level 1 Element Object


元素对象参考手册要素オブジェクト

その他の拡張