I have a callback, which I’ve had help on previously, which gets the last slide visible on a jCarousel.
The callback itself works, but its getting the list (which is the first tag), and I want it to get the alt attribute from the HTML. Is there anything I should be doing to delve deeper to grab the desired attribute?
I’m trying to get the alt attribute from the image tag and not the first list or anchor.
function itemVisibleIn(carousel) {
$("#gallerydescription").html( $(this).attr("alt"));
};
<li><a href="images/gallery/placeholder1.png" rel="shadowbox" title="This is the description">**<img class="caption" src="images/gallery/placeholder1.png" width="750" height="450" title="test Title1" alt="This is the title" />**</a></li>
If I’m understanding you correctly, you want to use
findto get thatimg. Something like this:If needed, the selector passed to
findcan be more specific to distinguish between multiple images. Possibly something like this, to just get the image with a class of caption: