Get attribute of newly created element
<p>I'm trying to get the <code>src</code> attribute of an image that has been added to the page after it has loaded, but the result keeps coming back <code>undefined</code>.</p>

<pre><code>$('#qtr').change(function() {
    data = {
        'img': $('#edit_image').attr('src'),
        'degrees': '90'
    };
    $.post('/ajax/ajax_images/rotate', data, function(response) {
        if (response.error != 0) {
            alert('Unable to rotate image');
        }
        else {
            $('#edit_image').attr('src', response.html);
            new_image = response.html;
            var start = new_image.lastIndexOf('/') + 1;
            new_image = new_image.substr(start);
        }
    }, 'json');
});​
</code></pre>

<p><code>$('#edit_image')</code> is the newly created image. Where am I going wrong?</p>
