가시성 사용 요소를 숨기거나 표시하려면 JavaScript의 속성을 사용하십시오.
예시
가시성 속성으로 작업하는 방법을 배우기 위해 다음 코드를 실행할 수 있습니다 -
<!DOCTYPE html>
<html>
<body>
<p id = "pid">Demo Text</p>
<button type = "button" onclick = "displayHide()"> Hide </button>
<button type = "button" onclick = "displayShow()"> Show </button>
<script>
function displayHide() {
document.getElementById("pid").style.visibility = "hidden";
}
function displayShow() {
document.getElementById("pid").style.visibility = "visible";
}
</script>
</body>
</html>