If my code is laid out like so,
<div data-page-index="1" class="active">
<img src="foo.png" />
</div>
how do I set a variable to the image path if i only have the div class, for example
var image1 = $('.active').find(img);
so I can append that image whenever neccessary?
Get the
srcattribute from, in this case the first instance of, your image.Working example