问题描述:

I use a thickbox to display some html content in a modal window.

I know the thickbox component is flagged as "not maintained, please try another component", but I don't have a choice on using it.

The html content is loaded through the documented "AJAX content" method :

<a href="ajax/ctnt?value1=10&value2=12&width=640&height=480"

class="thickbox">

click me

</a>

All of this works fine with simple html, a modal window pops with the correct content on my page.

My question :

I would like to initialize a jquery component inside the modal window after it has loaded.

e.g. :

$('.actDisplay').click( displayAction );

[EDIT]

I also need to initialize other javascript components. For example, I use fullcalendar to display the agenda of a week.

In order to initialize this component, I have to call

$('#agendaDiv').fullcalendar( options );

once the DOM is loaded.

[/EDIT]

Do you see some standard javascript or jquery event I could plug into to have this code executed after the DOM of the ajax answer has been loaded ?

For a full page, I would put it in the $(document).ready event. But in this case ?

Thanks in advance,

G

网友答案:

You could use jquery live method

$('.actDisplay').live('click', displayAction);

or inject a <script> tag at the end of your loaded content (possibily a trigger)

相关阅读:
Top