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);
매개변수
반환 값
사용 일람
많은 특성은 null을 대입했을 때 예상치 못한 동작을 하곤 합니다. 그러므로 특성을 삭제할 때 null을 직접 대입하거나, setAttribute()의 매개변수로 제공하기보�� removeAttribute() 메서드를 사용해야 합니다.
예제
js
// Given: <div id="div1" align="left" width="200px">
document.getElementById("div1").removeAttribute("align");
// Now: <div id="div1" width="200px">
명세
| Specification |
|---|
| DOM # ref-for-dom-element-removeattribute① |