visibility
ボタンの代わりにスタイルを使用するとdisplay
、適切に作成できるはずです。visibility: hidden
スタイルは要素を非表示にするだけです。display: none
$.hide() が使用するスタイルは、レンダリングされた DOM から要素を実際に削除します。
要するに試してみてください:
var newButton = $('a#some-button.hidden');
// Hide element, but allow it to use render space
newButton.attr('visibility', 'hidden');
newButton.attr('display', 'block');
// Create button
newButton.button();
// Revert element to the "normal" means of hiding (may be unnecessary)
newButton.attr('display', 'none');
newButton.attr('visibility', 'visible');
// Show button
newButton.show();
私はこれを数回前にやらなければなりませんでした。