버튼 유형 속성
예시
버튼 유형을 반환합니다.
var x = document.getElementById("myBtn").type;
정의 및 사용
type 속성은 버튼의 유형을 설정하거나 반환합니다.
팁: 항상 버튼의 유형 속성을 지정하십시오. Internet Explorer의 기본 유형은 "버튼"이고 다른 브라우저(및 W3C 사양)에서는 "제출"입니다.
브라우저 지원
Property | |||||
---|---|---|---|---|---|
type | Yes | Yes | Yes | Yes | Yes |
통사론
유형 속성을 반환합니다.
buttonObject.type
유형 속성을 설정합니다.
buttonObject.type = "submit|button|reset"
속성 값
Value | Description |
---|---|
submit | The button is a submit button (this is default for all browsers, except Internet Explorer) |
button | The button is a clickable button (this is default for Internet Explorer) |
reset | The button is a reset button (clears form data) |
기술적 세부 사항
반환 값: | 버튼 유형을 나타내는 문자열 |
---|
더 많은 예
예시
버튼 유형을 "제출"로 변경하십시오.
document.getElementById("myBtn").type = "submit";
예시
버튼 유형을 "재설정"으로 변경합니다.
document.getElementById("myBtn").type = "reset";
관련 페이지
HTML 참조: HTML <버튼> 유형 속성
❮ 버튼 개체