Movatterモバイル変換


[0]ホーム

URL:


  1. 개발자를 위한 웹 기술
  2. Web API
  3. Element
  4. Element.removeAttribute()

This page was translated from English by the community.Learn more and join the MDN Web Docs community.

View in EnglishAlways switch to English

Element.removeAttribute()

Baseline Widely available

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

Element.removeAttribute() 메서드는 요소에서 주어진 이름의 특성을 제거합니다.

구문

js
element.removeAttribute(attrName);

매개변수

attrName

요소에서 제거할 특성 이름을 지정하는DOMString. 지정하지 않으면 오류 없이 아무 동작도 하지 않습니다.

반환 값

undefined.

사용 일람

많은 특성은null을 대입했을 때 예상치 못한 동작을 하곤 합니다. 그러므로 특성을 삭제할 때null을 직접 대입하거나,setAttribute()의 매개변수로 제공하기보단removeAttribute() 메서드를 사용해야 합니다.

예제

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

명세

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

브라우저 호환성

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp