I know this is pretty basic, I’m trying to get the ‘src’ attribute of some images and put them in the same number of #image fields:
count = 0;
$('.selected').each(function() {
count++;
// the idea is to get the value from each ".selected img"
$('#image' + count).val( this + img ).attr("src");
});
How to reference the image from ‘this’ ? or what would be the good method ? …. Thanks !
EDIT:
I have something like this:
<li><img src="..." alt="" class="selected" /></li>
<li><img src="..." alt="" /></li>
<li><img src="..." alt="" /></li>
<li><img src="..." alt="" class="selected" /></li>
I want to write the src attribute of those img s in this:
<input type="hidden" id="image1" name="image1" value="" />
<input type="hidden" id="image2" name="image2" value="" />
Thanks!
Is this the sort of thing you mean?