<html lang="ko">
<head>
<meta charset="UTF-8">
<title>jQuery Style</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$(function() {
$("#check").change(function() {
// checked 속성의 속성값을 반환함.
$("#text").html("checked 속성의 속성값 : " + $(this).attr("checked")
+ "<br>checked 프로퍼티 값 : " + $(this).prop("checked")); // checked 프로퍼티 값을 반환함.
}).change(); // 값이 변할 때마다 갱신함.
});
</script>
</head>
<body>
<h1>.attr() 메소드와 .prop() 메소드와의 차이점</h1>
<input id="check" type="checkbox" name="lecture" checked="checked">
<label for="check">체크박스를 체크해 보세요!</label>
<p id="text"></p>
</body>
</html>