How can I get width from neighbour item, and not from the first one in code?
Hello.
I have this jQuery code:
-
var imgwidth = $('img').width()
-
$('div').css('left', imgwidth);
It works well. But only if there is just one
div &
img pair.
If three is second pair, value of
imgwidth are the one of the first item and all divs are left positioned the same way.
-
<table>
-
<tr>
-
<td>
- <img src="1.png" />
-
<div></div>
- </td>
-
<td>
-
<img src="2.png" />
-
<div></div>
- </td>
- </tr>
-
</table>
What should I do with my example to get
div to be left as more as its neighbour
img width are?
Thanks for attention.