Quantcast
Viewing all articles
Browse latest Browse all 10

ready() 이벤트 처리기 메서드

자바스크립트의 window.onload 이벤트를 대신할 수 있는 이벤트 처리기 메서드이다.

DOM이 완전히 로드된 후 DOM 조작 및 탐색을 처리할 때 사용한다.
사용방법은 다음과 같다.

<!DOCTYPE html>

<html>

<head>

<style>p { color:red; }</style>

<script src=”http://code.jquery.com/jquery-1.4.4.js”></script>

<script>

$(document).ready(function () {

$(“p”).text(“The DOM is now loaded and can be manipulated.”);

});

</script>

</head>

<body>

<p>Not loaded yet.</p>

</body>

</html>


Viewing all articles
Browse latest Browse all 10