"JQuery .ready()"의 두 판 사이의 차이

3번째 줄: 3번째 줄:
;jQuery onload
;jQuery onload


==1개==
==축약형 ★==
<source lang='html5'>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script>
$(function() {
  alert("로딩 완료");
});
</script>
</source>
 
==기본형==
<source lang='html5'>
<source lang='html5'>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
13번째 줄: 23번째 줄:
</source>
</source>


==여러 개==
==여러 개 테스트==
*아래와 같이 여러 개를 써도 정상 작동하지만 굳이 이렇게 할 필요는 없다….
<source lang='html5'>
<source lang='html5'>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>

2014년 7월 1일 (화) 22:55 판

jQuery ready
jQuery onload

1 축약형 ★

html
Copy
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script>
$(function() {
  alert("로딩 완료");
});
</script>

2 기본형

html
Copy
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script>
$(document).ready(function() {
  alert("로딩 완료");
});
</script>

3 여러 개 테스트

  • 아래와 같이 여러 개를 써도 정상 작동하지만 굳이 이렇게 할 필요는 없다….
html
Copy
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script>
$(document).ready(function() { alert("첫번째 ready()"); });
$(document).ready(function() { alert("두번째 ready()"); });
$(document).ready(function() { alert("세번째 ready()"); });
</script>

4 같이 보기

5 참고 자료