I’m trying to get the src of an image from a selected list item. The HTML looks like this:
<li id="player_7">
<div class="nailthumb-container square-thumb">
<img src="../photos/files/7/thumb/6c0f1676cdcb1a9a5215db3e12572450.jpeg" />
</div>
</li>
I can currently get the player ID from the selected list element like so:
jQuery
$('#myDiv').find("li").click(function() {
var user_id = $(this).attr('id').substr(7);
});
How can I get the img src from a selected list element?
If
user_idcorresponds to number in player ID, then try:Otherwise, respectively to the clicked list item: