1
我想在選擇自動完成項目後讓Jquery UI模式對話框接管。除了模式對話框啓動後,我的所有內容都會彈出,但有代碼正在運行。最後,我想讓這個對話框彈出並根據按鈕作出反應。Jquery - 選擇自動完成期間使用模式對話框
從選擇自動完成:
select: function(event, ui) {
if(ui.item.squad != '0'){
console.info('popup');
var choice=null;
$("#dialog-confirm").dialog({
resizable: false,
height:140,
modal: true,
buttons: {
Cancel: function() {
choice = false;
$(this).dialog("close");
},
"Move Shooter": function() {
choice = true;
$(this).dialog("close");
}
}
});
if(!choice){
console.info($(this));
$(this).text("");
$(this).val("");
$(this).attr("name", "");
$(this).attr("value", "");
console.info("false");
return;
}
}
大部分代碼已經從jQuery UI的拍攝here.
當我運行此代碼,我認爲它會停止運行代碼,直到一個按鈕是按下但您可以看到here將打印出錯誤的控制檯打印出來。
而你是我的英雄。謝謝您的幫助 – 2012-01-03 22:46:41