missed a line, the JS should be:

$('.foo').append('<a href="#"><img src="1.gif" class="1" alt="1st
image" /></a>');
$('.foo a img').click(function(event){
    event.preventDefault();
    var fAlt = $('.foo').attr('alt');
    $('.fooAlt').text(fAlt)
})

On Aug 14, 2:30 pm, Benn <bennmey...@gmail.com> wrote:
> I'm trying (rather unsuccessfully) to fill a div that was created by
> jquery. I feel like the code should work: any hints or solutions?
>
> Here's my html:
> <div class="test_area">
> <div class="foo"></div>
> <div class="fooAlt"></div>
> </div>
>
> Here's my javascript:
> $(document).ready(function(){
> $('.foo').append('<a href="#"><img src="1.gif" class="1" alt="1st
> image" /></a>');
> $('.foo a img').click(function(event){
>                 event.preventDefault();
>                 $('.foo').attr('alt');
>         })
>
> });

Reply via email to