How can I get width from neighbour item, and not from the first one in code?

How can I get width from neighbour item, and not from the first one in code?

Hello.

I have this jQuery code:
  1. var imgwidth = $('img').width()
  2. $('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.
  1. <table>
  2. <tr>
  3. <td>
  4. <img src="1.png" />
  5. <div></div>
  6. </td>
  7. <td>
  8. <img src="2.png" />
  9. <div></div>
  10. </td>
  11. </tr>
  12. </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.