HTML DOM removeAttribute()メソッド
例
ヘッダー要素の style 属性を削除:
document.getElementsByTagName("H1")[0].removeAttribute("style");
属性を削除する前:
Hello World
属性を削除した後:
Hello World
試してみる »
定義と用法
removeAttribute() メソッドは指定された属性を削除します
類似のメソッドを表示 removeAttributeNode() 。
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
すべての主要ブラウザは removeAttribute() メソッドをサポートしています
構文
element.removeAttribute(attributename)
パラメータ
| パラメータ | 型 | 説明 |
|---|---|---|
| attributename | String | 必須。削除する属性の名前を指定します。 |
戻り値
戻り値はありません。
技術詳細
| DOM バージョン | Core Level 1 Element Object |
|---|
その他の拡張
要素オブジェクト