我的模式对话框完美地工作(意味着我可以调整每个选项),除了按钮图标选项没有效果。这里是我用来生成对话框的代码: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,谢谢。支持。 –