views:

19

answers:

0

How could I change the code of jQuery Context Menu Plugin such that the context menu will appear also for items that are added in the future ?

For example, I would like the context menu to appear for all cells in a table that have my_class class. I set up the context menu like this:

$(".my_class").contextMenu(...)

Then, later, the user may add my_class class to cells in the table, or even add new cells to the table with my_class class. I want the context menu to appear also for these cells, but I don't want to call $(".my_class").contextMenu(...) each time new cell with my_class class is added.

I think this can be achieved somehow with .live() function of jQuery, but I'm not sure how.

Does anyone has any idea ?

Thanks !