after method does not invoke button click

after method does not invoke button click


Hi,
I have implemented the following code:
$(lastElement).after('<button type="button" id="1122">Uninvite</
button>');
$("button").click(function()
{
var id = $(this).attr('id');
console.log("this id " + id);
}
I see the button being displayed on the page but the problem occurs
when I click the Uninvite button as it is not invoking the click
function. Does anybody know what I am doing wrong or can give me any
pointers to resolve this issue?
Best Regards,
ShuttlesWorth