我有一個Ruby和Rails應用程序。在jQueryUi對話框中動態加載jQueryUi標籤不起作用
我正在使用Ajax加載表單。該表單是現有的導軌視圖。該表單反過來包含jQueryUi選項卡。
不幸的是,當表單加載到jQuery對話框中時,不會顯示這些選項卡。
下面是對話框
$('#create_candidate').click(function(e) {
var url = $(this).attr('href').replace('?','.js?');
var new_candidate_dlg = $('<div id="new_candidate_dlg">Loading form ...</div>');
new_candidate_dlg.load(url);
new_candidate_dlg.dialog({
autoOpen:false,
width: 'auto',
height: 'auto',
modal: true,
close: function() {
$('new_candidate_dlg').remove();
},
open: function() {
$('#tabs').tabs();
}
});
new_candidate_dlg.dialog('open');
e.preventDefault();
});
代碼奇怪的是,如果我改變像下面的代碼,卡口都出現,但只有當我點擊選項卡。
$('#create_candidate').click(function(e) {
var url = $(this).attr('href').replace('?','.js?');
var new_candidate_dlg = $('<div id="new_candidate_dlg">Loading form ...</div>');
new_candidate_dlg.load(url);
new_candidate_dlg.dialog({
autoOpen:false,
width: 'auto',
height: 'auto',
modal: true,
close: function() {
$('new_candidate_dlg').remove();
},
open: function() {
$('#tabs').live('click', function(){
$(this).tabs()
});
}
});
new_candidate_dlg.dialog('open');
e.preventDefault();
});