How do I put the div id tag into an array an then output the image's alt text using a loop?
For e.g., I have the following code...
<div id="imageGallery" style="left: 800px; position: absolute; top: 200px">
<center>
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td><a href="#"><img alt="Random Image 1" src="../Images/thumbnails/random1.jpg"
style="border-color: #000000; border-width: 2px; border-style: ridge"></a></td>
<td><a href="#"><img alt="Random Image 2" src="../Images/thumbnails/random2.jpg"
style="border-color: #000000; border-width: 2px; border-style: ridge"></a></td>
<td><a href="#"><img alt="Random Image 3" src="../Images/thumbnails/buckstb01.jpg"
style="border-color: #000000; border-width: 2px; border-style: ridge"></a></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td><center><a href="#"><img alt="Random Image 4" src="../Images/thumbnails/portrait.jpg"
style="border-color: #000000; border-width: 2px; border-style: ridge"></a></center></td>
</tr>
</table>
</center>
</div>
I would like to put the id "imageGallery" into an array and output it's alt text afterwards.
To Caius
I've tried so many different variations.
var imageGallery = [ $( "#imageGallery img" ) ];
for( i = 0; i <= imageGallery.length; i++ )
{
$( "#imageGallery" ).attr( "alt" );
}
Sometimes it would print out 1 letter at a time or just one set at a time, when I want the whole set.
I can't remember if I did it this way as I tried so many different variations and forgot to save it as it didn't work.