I've an <img> plus some <p>'s in the <div>.

I wish to obtain the width from the child img and put it on towards the width from the parent div to ensure that the sentences of text will wrap towards the same width because the img.

I wish to have the ability to do that to multiple iterations on a single page.

Background: I'm creating a wordPress theme that utilizes the masonry jquery wordpress plugin (http://desandro.com/assets/jquery-masonry). My theme has something that is similar to Gridalicious theme (http://suprb.com/applications/gridalicious) however the publish sizes and dimensions is going to be determined through the image width and won't be uniform.

My html/css is spotless but my jquery / javascript is fairly shaky - but when I'm able to acquire some pointers I ought to have the ability to use it.

Any help truly appreciated.

This can find all of the divs around the page and hang their sizes comparable to their img child element's width.

 $('.divselector').attr('width', $(this).find('img').attr('width'))

This works perfectly. Note you need to use $(window).load() rather than $(document).ready(), because $(document).ready() fires before images are really loaded, and therefore the pictures may have no width.

$(window).load(function() {
    $('div').each(function() {
        $(this).width($(this).find('img').width());
    });
});

Edit: Observe that this can base the width from the first image within the div. Simply alter the index ([]) to base them back another image within the div.

Edit 2: Applied John's correction around the .width() function.