메서드 removeAttribute

메서드 removeAttribute는 주어진 태그의 특정 속성을 삭제합니다.

구문

javascript요소.removeAttribute(속성 이름);

예시

요소의 value 속성을 삭제해 보겠습니다:

html<input id="elem" value="abcde">
javascriptlet elem = document.querySelector('#elem');
elem.removeAttribute('value');

HTML 코드는 다음과 같이 될 것입니다 (value 속성이 사라짐):

html<input id="elem">

참고 항목