작성
·
295
1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="/css/style.css" />
</head>
<body>
<script src="/js/code.jquery.com_jquery-3.7.0.js"></script>
<script src="/js/custom.js"></script>
<a class="show-btn" href="#">보이기</a>
<a class="hide-btn" href="#">감추기</a>
<div>Box</div>
</body>
</html>
$(document).on('click', '.show-btn', function () {
$('div').show();
});
$(document).on('click', '.hide-btn', function () {
$('div').hide();
});
click함수로 쓸때 작동이 안되고 on함수로 썼을 때 작동이 되는데 이유가 무엇인가요?