[jQuery] Re: Access Elements Rendered in a Thickbox
Your thickbox script most certainly provides a callback function where you could add those handlers, which one are you using? On Dec 16, 5:25 pm, Rob Wilkerson r.d.wilker...@gmail.com wrote: Hey all - I'm looking for/wondering whether there is a way to access an element loaded in a thickbox. I have a page that launches thickbox to load a form. I need to be able to set a click() event listener on the submit button of that form so that I can submit the form via ajax. Unfortunately, I can't come up with a clever way of doing that. Any ideas? I tried (just for the sake of eliminating the obvious) applying the event listener on document ready, but no luck, of course, since I assume that the form's submit button doesn't exist until the thickbox is loaded. Is there any way to make this happen? Thanks.
[jQuery] Re: Access Elements Rendered in a Thickbox
On Dec 16, 3:33 pm, Ricardo Tomasi ricardob...@gmail.com wrote: Your thickbox script most certainly provides a callback function where you could add those handlers, which one are you using? Hey Ricardo - I'm using http://jquery.com/demo/thickbox/. I'll dig a little deeper. I was hoping someone already knew the answer and could spare me hours. :-) Thanks.
[jQuery] Re: Access Elements Rendered in a Thickbox
I can't directly answer your question, but the reason that adding the event listener to the hidden button on document ready does not work is this (or at least this is what the library I was working with did): When the Thickbox loads, it does not directly reference the container it's loading. It takes the HTML from the container and basically cut/pastes it (document - thickbox). When you close the Thickbox it cut/pastes in the other direction (thickbox - document). By doing so, its eliminating any events you're adding to the elements initially. I can't remember if you can even access the elements using the standard $('element'). syntax once they are inside Thickbox. If not, you could use the livequery plugin (http://docs.jquery.com/ Plugins/livequery).