1. 선택or감추기 클릭시 반응 2.보이기 클릭시 반응
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</head>
<body>
<!-- JQuery -> Ajax (Json) -> Server(Java) (list, hashmap) -->
<ul id="list">
<li>Coffee
<ol type="1">
<li>black</li>
<li>milk</li>
</ol>
</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<button type="button" id="btn">선택 or 감추기</button>
<button type="button" id="btn1">보이기</button>
<script type="text/javascript">
$(function(){
$("#btn").click(function(){
//$("#list").hide();
//$("ul li:first").hide(); //첫번째 li만 사라진다.
//$("#list li:first").hide(); //첫번째 li만 사라진다
//$("ul ol li:first").hide();
//$("ul ol li:first-child").hide();
$("ul ol li:nth-child(2)").hide(); //자식테그 1번부터~ 지정할 수 있음.
});
$("#btn1").click(function(){
$("ul ol li:nth-child(2)").show();
});
});
</script>
</body>
</html>