Adding a <Img> tag dynamically
<p>Originally, my image container div was:</p>

<pre><code>&lt;div id="offer_image" class="img_preview_container" /&gt;
&lt;a class="preview_overlay"&gt;&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>Then this executed:</p>

<pre><code>$('#image_upload_form input').change(function() {

    if ( $(this).val() == '') return false;

    $('#image_upload_form').ajaxSubmit({
        success: function ( data ) { 
            if ( (/^http:\/\//).test(data) ) {
                $('#offer_detail input[name=image]').val(data);
                myImage = new Image();
                myImage.src = data;
                $(myImage).load(function() {
                    $('#offer_image').updateimgto(myImage.src);
                });
            }
            else {
                $('&lt;div&gt;&lt;/div&gt;').html(data).dialog({ title: 'Unable to upload your image' });
            }
        },
    });

});
</code></pre>

<p>When that JavaScript code executed, an <code>&lt;img&gt;</code> tag is added to the orignal image container div:</p>

<pre><code>&lt;div id="offer_image" class="img_preview_container" /&gt;
    &lt;a class="preview_overlay"&gt;&lt;/a&gt;
    &lt;img src="http://www.test.com/pic1.png", alt="uploaded img"&gt;
&lt;/div&gt;
</code></pre>

<p>I am not sure where exactly the tag <code>&lt;img&gt;</code> is being added. Is it:</p>

<ol>
<li><code>$('#offer_image').updateimgto(myImage.src)</code>?</li>
<li>I put <code>myImage.title="my pic"</code> in the JavaScript but it doesn't add to that <code>&lt;img&gt;</code> tag output. Why?</li>
</ol>
