I hope the title is self explanatory.
Here is my HTML (there are many of these items):
<div class="shopTextWrapper">
<div class="shop_item">
<a href="#dialog2" name="modal">
<img src="objetdart/images_sm/ethanol-i.jpg" width="75" height="75"></a>
</div>
<br clear="all" />
<p class="desc_text">
Ethanol
</p>
</div>
My current jQuery (not working):
$(document).ready(function() {
$('img').each(function(){
var $altText = $(this).find('div p.desc_text');
$('img').attr('alt', $altText);
});
});
I need to find each span desc_text which is contained inside a parent div which also contains the appropriate image. I am currently returning object Object.
Any ideas how to get the title for the image that is contained within the shopTextWrapper div?
Thank you
1 Answer