HTML DOM 입력 검색 유형 속성은 type=”search”가 있는 입력 요소와 연결됩니다. 항상 입력 검색 요소에 대한 검색을 반환합니다.
구문
다음은 검색 유형 속성의 구문입니다 -
searchObject.type
예시
입력 검색 유형 속성의 예를 살펴보겠습니다 -
<!DOCTYPE html>
<html>
<body>
<h1>Search type property</h1>
<form>
FRUITS: <input type="search" id="SEARCH1" name="fruits">
</form>
<p>Get the above element type by clicking the below button</p>
<button onclick="getType()">Get Type</button>
<p id="Sample"></p>
<script>
function getType() {
var t = document.getElementById("SEARCH1").type;
document.getElementById("Sample").innerHTML = "The type for the input field is : "+t;
}
</script>
</body>
</html> 출력
이것은 다음과 같은 출력을 생성합니다 -

"유형 가져오기" 버튼 클릭 시 -
