jquery5 - 문서 로르 후 콜백

조수경·2021년 11월 22일
0

HTML

목록 보기
70/96
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel = "stylesheet" href = "../css/mystyle.css" type="text/css">
<script src="/jqpro/js/jquery-3.6.0.min.js" type="text/javascript"></script>
<script type="text/javascript">

$(function(){
	$('h1').css('color', 'blue');
	$('h1').first().css('color', 'red');
	$('h1').eq(2).css('color', 'green');
	
})

/* $(document).ready(function(){
	$('h1')
})
window.onload = function(){
	$('h1')
} */

</script>

</head>
<body>

<div class = "box">
문서로드된 후에 호출되는 콜백 함수<br>
  1. window.onload = function(){}<br>
  2. $(document).ready(function(){ })<br>
  3. $(function(){ })<br>
  <br>
    $('h1').css('color', 'blue');<br>
	$('h1').first().css('color', 'red');<br>
	$('h1').eq(2).css('color', 'green');<br>
  
   <br>
  <div id = "result1">
    <h1>무궁화 꽃이 피었습니다</h1>
    <h1>바람에 낙엽이 춤을 춥니다</h1>
    <h1>꼭꼭 숨어라 머리카락 보일라</h1>
    <h1>꼭꼭 숨어라 머리카락 보일라</h1>
    <h1>꼭꼭 숨어라 머리카락 보일라</h1>
  </div>
</div>
</body>
</html>
profile
신입 개발자 입니다!!!

0개의 댓글