jquery에서 작업 숨기기

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>myFirstJquery.html</title>
		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript">
			// $(document).ready(function(){
			// 	$("p").click(function(){
			// 		$(this).hide();
			// 	});
			// });

			$(document).ready(function(){//             (        )
				$("button").click(function(){
					$("#2").hide();//   id 2
					$(".3").hide();//    class 3
					$("p.4").hide();// p class 4
					// $("p").hide();//   p
					$("p").css("background-color","red");
				});
			});
		</script>
	</head>
	<body>
		<div>
			<p>When you click there, the content will dispear1.</p>
			<p id="2">When you click there, the content will dispear2.</p>
			<p class="3">When you click there, the content will dispear3.</p>
			<p class="4">When you click there, the content will dispear4.</p>
			<p>When you click there, the content will dispear5.</p>
			<button type="button">button</button>
		</div>
	</body>
</html>

좋은 웹페이지 즐겨찾기