问题
I have the following markup and JS on a web page: http://jsfiddle.net/R2Jj2/
It seems to work well.
When I open this content in a thickbox window the datepicker fails to load properly.
Any idea how I can get the datepicker to work?
回答1:
The datepicker isn't working correctly because it's probably calling stuff within the onLoad function. Try Colorbox.js, it has an onComplete specifically for handling this.
http://colorpowered.com/colorbox/
JavaScript/jQuery is not working inside of ColorBox.
This is often due to trying to access an element before it has been loaded into the document and can be resolved by moving the JavaScript into ColorBox's onComplete callback.
Example (using jQuery Forms plugin): $('#login_window').colorbox({onComplete:function(){ $('form#login').ajaxForm(); }});
来源:https://stackoverflow.com/questions/4809391/jquery-ui-datepicker-inside-a-thickbox