If you are adding a html dynamically  and then binding the .click event of an element  then this will not work

the .click event will never bind

in order to make the events works for the dynamic html or elements  use .live like below

$('#ElementID').live('click', function (event) {
if (event.button != 0) {
// left button - ignore it
return true;

} else {
//right button
var id = $(this).attr('id'); // do something

return false; // "capture" the click
}
});

Also you might have noticed that i have a check to see which button was clicked , because in  .live method left and right mouse buttons both  bind to click event unlike the .click event only right button is bind so we have to check in .live which button was clicked