Hopefully when I click the button I can get the specific img src and show img src in the img-block div img-block .
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); });
But now I am facing a problem - get img src.
Therefore, I use a warning to conduct the test, as a result, it does not warn anything.
jquery
Chen-Tai Hou Nov 12 '13 at 18:32 2013-11-12 18:32
source share