728x90
반응형
html onclick속성 자바스크립트
<div class="col-md-5" id="noneDiv" style="display: none;"></div>
<button onclick="onDisplay()">숨은 DIV보이기</button>
<button onclick="offDisplay()">DIV 숨기기</button>
<scrpit>
function onDisplay() {
$('#noneDiv').show();
}
function offDisplay() {
$('#noneDiv').hide();
}
</scrpit>
JQuery 클릭이벤트
<div class="col-md-5" id="noneDiv" style="display: none;"></div>
<button id="onDisplay">숨은 DIV보이기</button>
<button id="offDisplay">DIV 숨기기</button>
<script>
$(function(){
$('#onDisplay').click(function(){
if($("#noneDiv").css("display") == "none"){
$('#noneDiv').show();
}
});
});
</script>
<script>
$(function(){
$('#offDisplay').click(function(){
if($("#noneDiv").css("display") != "none"){
$('#noneDiv').hide();
}
});
});
</script>
728x90
반응형
'JavaScript > jQuery' 카테고리의 다른 글
[jQuery] css() 함수 사용 문법 종류 (0) | 2022.01.03 |
---|---|
filter() 와 메서드 체이닝, end() , add() 메소드 (0) | 2022.01.03 |
each() 함수 '요소' 관리 사용 문법 (0) | 2022.01.03 |
속성선택자 , (입력양식)필터 선택자 / 요소[속성=값] , 요소:속성 (0) | 2022.01.03 |
[jQuery] <button> 클릭 이벤트 / 이벤트발생시 value를 담아 url로 전송하기 (0) | 2020.09.07 |