노빠꾸 개발일지/JQUERY & JAVASCRIPT

[JQuery] jQuery 시작하기 - .ready()

No Backing 2020. 9. 29. 00:33
반응형


jQuery의 .ready()함수에 대해 포스팅해 보겠습니다.

 

.ready() 함수는 Dom이 완전히 로드되었을 때 실행 할 함수를 지정합니다.

 

즉, html화면이 다 그려진 후 실행할 함수를 입력하는 부분입니다.

 

이 함수에서 주로 화면에 필요한 초기화작업을 진행하게 됩니다.

 

.ready() 함수는 아래 두가지 방법으로 사용할 수 있습니다.

1
2
3
$( document ).ready(function() {
  // Handler for .ready() called.
});
cs

 

 

1
2
3
$(function() {
  // Handler for .ready() called.
});
cs

 

더욱 자세한 내용을 참고하시고 싶으시면, 아래 jQuery 공식 문서를 참고해주세요!

 

출처 - api.jquery.com/ready/#ready-handler

 

.ready() | jQuery API Documentation

Description: Specify a function to execute when the DOM is fully loaded. The .ready() method offers a way to run JavaScript code as soon as the page's Document Object Model (DOM) becomes safe to manipulate. This will often be a good time to perform tasks t

api.jquery.com

반응형