jquery1

조수경·2021년 11월 22일
0

HTML

목록 보기
66/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="../js/jquery-3.6.0.min.js"></script>

<script>
/* window.onload=function(){
	//document.getElementById('result1').style.backgroundColor = 'red';
	$('#result1').css('background-color', 'red')
	
} */

$(document).ready(function()){
	$('#result1').css('background-color', 'red')
	//document.getElementById('result1').style.backgroundColor = 'red';
})
</script>

</head>
<body>

<div class = "box">
  실행시 result1의 배경색을 바꾼다<br>
  스크립트를 body위에 코딩<br>
  스크립트에서 html요소에 접근하기 위해서<br>
   window.onload=function(){}<br>
   $(document).ready(function()){}<br>
   
   
   <br>
  <button type = "button">확인</button>
  <div id = "result1"></div>
</div>
</body>
</html>
profile
신입 개발자 입니다!!!

0개의 댓글