vodkabears / Remodal

No longer actively maintained.
http://vodkabears.github.io/remodal/
MIT License
2.75k stars 769 forks source link

Support: Read data from clicked element #260

Open solepixel opened 8 years ago

solepixel commented 8 years ago

Is it possible to load content dynamically into the modal using the "opening" event by reading information from the clicked element? I'm trying to use:

$(document).on('opening', '.remodal', function(e) {
    console.log(e);
});

However e doesn't seem to have the element that was clicked. e.target appears to be the actual modal. Any way to grab the clicked element?

If not, what's the best way to pass data into the modal for loading?

AlexPashley commented 8 years ago

+1

I have a list of records in a table. I would like to dynamically pass data or get the clicked element so I can identify which row to delete.

solepixel commented 8 years ago

I ended up accomplishing this by creating the modal dynamically from the click event of the source element, but I think passing the clicked element into the opening callback would be a much more elegant solution.