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

잔글 (로봇: 자동으로 텍스트 교체 (-http://jmnote.com/jq/ +http://zetawiki.com/jq/))
잔글 (로봇: 자동으로 텍스트 교체 (-http://zetawiki.com/jq/ +http://zetawiki.com/ex/jquery/))
15번째 줄: 15번째 줄:
</script>
</script>
</source>
</source>
*예제: http://zetawiki.com/jq/ready2.php
*예제: http://zetawiki.com/ex/jquery/ready2.php


==축약형 ★==
==축약형 ★==
26번째 줄: 26번째 줄:
</script>
</script>
</source>
</source>
*예제: http://zetawiki.com/jq/ready1.php
*예제: http://zetawiki.com/ex/jquery/ready1.php


==여러 개 테스트==
==여러 개 테스트==
38번째 줄: 38번째 줄:
</script>
</script>
</source>
</source>
*예제: http://zetawiki.com/jq/ready3.php
*예제: http://zetawiki.com/ex/jquery/ready3.php


==같이 보기==
==같이 보기==

2015년 7월 15일 (수) 00:55 판

1 개요

jQuery ready
jQuery onload

2 기본형

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

3 축약형 ★

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

4 여러 개 테스트

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

5 같이 보기

6 주석

  1. 정확히는 DOM

7 참고 자료