views:

291

answers:

0

I am using Wildbit's ModalBox to load an external page in a modal window. I'm trying to get a datepicker JS script to run inside of this modal window, but it just...won't work.

I know ModalBox has callback functions, which allow you to execute a function after the modal window has loaded; for example:

Modalbox.show(url, {afterLoad: function() { alert('Content loaded successfully')}});

I think my problem is that I don't know which function to call, since the date picker JS has about 120 of them. There seems to be a main datePicker function, which looks like this:

// The datePicker object itself 
datePicker = function(options) { ...

I therefore use the following code, but the date picker fails to load:

<a onclick="Modalbox.show('..url..', { evalScripts: true, afterLoad: function() { datePicker(); }}); return false;" title=".." href="#">Click Me</a>

Does anyone out there know how to properly load a JS file after a modal window is called? Is it a matter of knowing which function to reference, or is it something else?

FWIW, I tried following another thread here on this topic. I changed all function calls from

function coolFunc() {...

to

coolFunc = function() {...

But the date picker still fails to load.