JQUERY 객체 숨기기hide(), 보이기 show()
html
<div id="box" style="display:none">안녕하세요!</div>
<button type="button" id="showBox">보이기</button>
<button type="button" id="hideBox">숨기기</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(function(){
// 보이기
$("#showBox").click(function(){
$("#box").show();
});
// 감추기
$("#hideBox").click(function(){
$("#box").hide();
});
});
</script>
728x90
반응형
LIST
'JQUERY' 카테고리의 다른 글
jquery 최신버전 적용방법, 버전변경없이 딱 한번으로 (21) | 2025.04.02 |
---|---|
JQUERY 도시선택 시 구/군을 선택할 수 있는 script 1분 안에 따라하기 (4) | 2025.03.20 |
JQUERY select box 선택된 값 가져오기 (0) | 2023.11.06 |
JQuery Datepicker로 완벽한 날짜 입력! 이렇게 하면 쉽고 빠르다! (0) | 2023.11.06 |
JQUERY class, id, name으로 접근 event (0) | 2023.11.06 |