I use tb_show() in my wordpress editor after clicking my custom shortcode button.
tb_show(“My Shortcodes”, “my-custom-panel.html”);
where tb_show is out of my control.
How can I bind events for a button within my-custom-panel.html after the page loads?
I have a restriction that I can’t put the javascript within “my-custom-panel.html”.
Thanks
You may use a delegated handler for the button that is within your
my-custom-panel.html
even if it’s not loaded yet in theDOM
, for example:If you load the content dynamically after
DOM
has loaded then still this will work. I’ve usedclick
event for the example tho.