我的模式對話框完美地工作(意味着我可以調整每個選項),除了按鈕圖標選項沒有效果。這裏是我用來生成對話框的代碼:jQuery UI模式對話框:按鈕圖標不出現
$('#alert_div')
.attr("title", "Delete all instances?")
.text("Are you sure you want to delete all instances of this event between the specificed dates? This cannot be undone.")
.dialog({
modal: true,
draggable: false,
position: { my: "top", at: "center", of: window },
buttons: [
{
text: "No",
icons: { primary: "ui-icon-check" },
click: function() {
$(this).dialog('close');
console.log('Clicked no.');
}
},
{
text: "Yes",
click: function() {
$(this).dialog('close');
console.log('Clicked yes');
}
}
]
});
我已經看過了我能找到的所有相關堆棧溢出問題 - 例如, this one。除了將元素附加到打開的按鈕上,我不知道如何解決這個問題。當我在文檔的其他地方創建元素並給他們適當的課程時,圖標顯示正確。
這裏的HTML打開的對話框時,jQuery的生成按鈕:
<div class="ui-dialog-buttonset"><button type="button" icons="[object Object]" class="ui-button ui-corner-all ui-widget">OK</button></div>
我猜想應該有比其他東西「的翻譯: 中的圖標屬性。這是爲什麼發生?我正在使用jQuery UI v。1.12.0和jQuery v。3.0.0。,並且我沒有使用Bootstrap。
更新:這裏是別人的報告幾乎完全從一個而jQuery的論壇同樣的問題後面:HTTPS:/ /forum.jquery.com/topic/adding-icons-to-dialog-buttons-and-setting-focus –
你檢查過瀏覽器的控制檯是否有錯誤?你有鏈接,我們可以看到,或者你可以創建一個jsFiddle或堆棧片段? – j08691
在控制檯上沒有錯誤,但我會做一個jsFiddle,謝謝。支持。 –