开发者

Why does a datepicker created on a detached div have zero height in Chrome?

开发者 https://www.devze.com 2023-03-19 09:33 出处:网络
When creating a jQuery UI datepicker on a detached div it works fine in Firefox but in Chrome it gets zero height.

When creating a jQuery UI datepicker on a detached div it works fine in Firefox but in Chrome it gets zero height.

$('<div/>').datepicker().appendTo('#some-element');

When attaching the div to the document first it works fine:

$('<div/>').appendTo('#some-element').datepicker();

However, since the actual code is not that simple (lots of legacy开发者_如何学编程 code, so attaching the div before creating its contents is difficult) I'm looking for a solution where the datepicker works even when created on a detached div.

Demo: http://jsfiddle.net/ThiefMaster/ZM95R/


This bug has been fixed

http://bugs.jqueryui.com/ticket/7552

and will be in the 1.8.15 release of jQuery UI

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号