jquery이미지생성

조수경·2021년 11월 22일
0

HTML

목록 보기
73/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"></script>

<script>
$(function(){
	$('button').on('click', function(){
		vimg = $('<img>',{ 
			'src' : '../images/가구1.jpg',
			'alt' : '가구1.jpg',
			'click' : function() {
				$(this).css('border', '2px solid red');
				
			}
		})
		vimg.appendTo($('#result1'));
	})
	
})
</script>
</head>
<body>

<div class = "box">
  이미지생성 버튼을 클릭하면 새로운 이미지를 생성하여 result1에 추가한다
   <br>
  <button type = "button">이미지생성</button>
  <div id = "result1"></div>
</div>
</body>
</html>
profile
신입 개발자 입니다!!!

0개의 댓글