HTML 숨겨진 속성은 숨겨진 속성이 있는 요소가 더 이상 문서와 관련이 없으며 사용자에게 표시되어서는 안 된다는 것을 사용자에게 알리는 데 사용됩니다.
숨겨진 의 예를 살펴보겠습니다. 속성 -
예시
<!DOCTYPE html>
<html>
<head>
<title>HTML hidden attribute</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>HTML-hidden-attribute</legend>
<input type="text" id="textSelect" placeholder="Your Authorization Level">
<select id="selection1" hidden>
<option>Add user</option>
<option>Delete user</option>
<option>Modify user</option>
</select>
<select id="selection2" hidden>
<option>Mail admin</option>
<option>Call admin</option>
</select>
<input type="button" value="go" onclick="displaySelection()">
<div id="divDisplay">Hello</div>
</fieldset>
</form>
<script>
var textSelect = document.getElementById("textSelect");
var divDisplay = document.getElementById("divDisplay");
var selection1 = document.getElementById("selection1");
var selection2 = document.getElementById("selection2");
function displaySelection() {
if(textSelect.value === 'admin'){
selection1.hidden = false;
selection2.hidden = true;
divDisplay.textContent = 'Welcome Admin';
} else if(textSelect.value === 'user'){
selection2.hidden = false;
selection1.hidden = true;
divDisplay.textContent = 'Welcome User';
} else{
selection2.hidden = true;
selection1.hidden = true;
divDisplay.textContent = 'Your input does not match any authorization';
}
}
</script>
</body>
</html> 1) '이동' 클릭 사용자 인증 수준의 버튼 -

2) '이동' 클릭 관리자 권한 수준의 버튼 -

3) '이동 클릭 ' 버튼이 승인되지 않은 수준 -
