I have a simple image gallery with different image size. I'm going to get the width of the current image and assign it to it's parent div using jquery but I can't seem to get it working. Thanks for any help. 

```
var imgWidth = $("#image").width();
$("#gallery").css({ width : imgWidth });

```

Sample HTML:

```
<div id="gallery">
 <img src="123.jpg" id="image" />
</div>

```