$('#test').hide() - 특정 ID 요소 숨김

$("#test").hide()

ID가 "test"인 요소를 숨깁니다.

예제:

<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#test").hide();
});
});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</head><body>

<h2>제목</h2>

<p>첫 번째 문장</p>
<p id="test">아래 버튼 클릭 시 숨겨지는 문장</p>

<button>클릭</button>
</body></html>

실행 예:
jQuery - 특정 ID를 가진 요소 숨기기

(Source: w3schools.com)

일부 글에 제휴 링크가 포함될 수 있으며 파트너스 활동으로 일정액의 수수료를 받을 수 있습니다.

댓글 남기기

* 이메일 정보는 공개되지 않습니다.