I have N(1..500) buttons create dynamically and I want know which button is clicked by the user and get the Id. I'm using this jQuery function but it doesn't work:
$(':button').click(function() {
// reference clicked button via: $(this)
var buttonElementId = $(this).attr('id');
alert(buttonElementId);
});