Is it possible to retrieve the image src after clicking on another image?
$(document).ready(function() {
$('img.getimage').click(function() {
alert($(this).attr('src'));
});
});
.sinistra {
width: 150px;
}
.getimage {
width: 50px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div id="content">
<div id="mywrap">
<img class="getimage" src="http://icons.iconarchive.com/icons/umut-pulat/tulliana-2/128/k-get-icon.png" /><br />
<img class="sinistra" src="http://www.bicielettriche.bikeitalia.it/wp-content/uploads/2014/11/bici-elettrica-piaggio.png" />
</div>
<br /><br /><br />
<div id="mywrap">
<img class="getimage" src="http://icons.iconarchive.com/icons/umut-pulat/tulliana-2/128/k-get-icon.png" /><br />
<img class="sinistra" src="https://eradellabicicletta.files.wordpress.com/2013/01/bici-da-corsa-rb1000-team-edition.jpg" /><br />
</div>
</div>
If an img element with the class 'getimage' is clicked, the goal is to access the src attribute of the image within the same div identified by the ID mywrap. There should be no additional classes or divs added.
Access the fiddle