How to click on a link just created using click event?

How to click on a link just created using click event?

How can I give a click on a link when it is just created and added to DOM?

None of this works:
  1. function openProfilePage(profile){
        $('#profile-link').remove();
        var link = $('<a/>').attr({'href':'profile.php?user='+profile, 'target':'_blank', 'id':'profile-link'}).css({'top':'-200px','left':'-300px', 'position':'absolute'}).html(profile);
        $('body').append(link);
        $('#profile-link').bind('click', function(e) { alert('This works but doest not open a new window as it sould'); }).click();
        $('#profile-link').click();
        $('#profile-link').trigger('click');
    }