.removeAttr()
.removeAttr()은 선택한 요소의 특정 속성을 제거합니다.
기본형
.removeAttr( attributeName )
예를 들어
$( 'h1' ).removeAttr( 'title' );
은 h1 요소에서 title 속성을 제거합니다.
예제
input 요소의 placeholder 속성을 제거합니다.
<input type="text" name="address" placeholder="Input Address">
<button class="a">Click to removeAttr</button>
input {
display: block;
font-size: 30px;
}
$( document ).ready( function() {
$( 'button.a' ).click( function() {
$( 'input' ).removeAttr( 'placeholder' );
});
});