버튼을 클릭하면 특정 img src를 얻고 div 클래스 img-block블록 에 img src를 표시 할 수 있기를 바랍니다 .
HTML
<button class="button">Click</button>
<div class="img1">
<img src="img.jpg" alt="">
</div>
<div class="img-block"></div>
CSS
.img-block{
position: absolute;
top:10%;
right:10%;
background-color: red;
width: 500px;
height: 500px;
}
.img1 img{
width: 200px;
}
JS
$('.button').click(function(){
var images = $('.img1 img').attr(src);
alert(images);
});
하지만 이제 문제는 img src를 얻는 것입니다.
그래서 경고를 사용하여 테스트를 수행하면 결과가 아무것도 경고하지 않습니다.