This page was translated from English by the community.Learn more and join the MDN Web Docs community.
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() 메서드는 요소에서 주어진 이름의 특성을 제거합니다.
In this article
구문
js
element.removeAttribute(attrName);매개변수
반환 값
사용 일람
많은 특성은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①> |