Hi guys, this is my first post here so go easy on me :)

When uding append() to add new xhtml elements to a page, why cannt
javascript recognise event related to the new elements?

for example

using the JQuery

        $('a').click(function(){
                alert($(this).text());
                return false;
        });

$('#content').empty().append('<a href="#">123</a>');  - successful
alert

$('#content').empty().load('step1.htm'); - contains the same anchor
but does not trigger the alert


$('form').submit(function(){

                $.post('server file',$
(this).find('input').serialize(),function(newForm) {
                        $('#content').empty().append(newForm);
                });

return false;
});

 on this example the old form is replced by a new form after a
submit.  The new form is pretty much identical to the old one but
JQuery doesnt recognise the submit event on the appended new form.


Can anyone shed some light on this?

thanks
slh

Reply via email to