Invoking Thickbox from Javascript

I recently needed to use Thickbox functionality in a place where I wanted the Thickbox to appear without user interaction. This was mainly to keep the appearance of the dialog in line with what we use elsewhere. To do this, it's possible to create a url that will never be called and use Thickbox's built-in functionality for handling inline content.

The variable should store a url just as you would normally create for use with Thickbox links. This can include various options, including height, width, modal state, and the id for the div that holds the inline content.

The first step was to create the HTML portion that would be displayed in the modal Thickbox. For some reason Thickbox wouldn't display the text unless it was contained within paragraph elements.

Next we can use jQuery to create an event trigger for after the document is ready. I found that the Thickbox invocation didn't work, at least not reliably, without waiting for the document ready event, which makes sense if the DOM hadn't been built out yet.

Pretty simple, and very effective for my needs.