我的按钮是空白的(使用modal、jquery)
这是我的脚本,我在其中设置按钮的文本我的按钮是空白的(使用modal、jquery),jquery,asp.net-mvc,Jquery,Asp.net Mvc,这是我的脚本,我在其中设置按钮的文本 $(document).ready(function () { $("#dialog-confirm").dialog({ autoOpen: false, modal: true, resizable: false, height: 150, buttons: [ {
$(document).ready(function () {
$("#dialog-confirm").dialog({
autoOpen: false,
modal: true,
resizable: false,
height: 150,
buttons: [
{
text: "Confirm",
click: function() {
window.location.href = targetUrl;
}
},
{
text: "Cancel",
click: function() {
$(this).dialog("close");
}
}]
});
$(".deleteLink").click(function (e) {
e.preventDefault();
var targetUrl = $(this).attr("href");
$("#dialog-confirm").dialog("open");
});
});
这是我的html代码
<div id="dialog-confirm" title="Delete" >
<p><span class="ui-icon ui-icon-alert"></span>Are you sure you would want to delete?
</div>
您确定要删除吗?
有人能看出这里出了什么问题吗?我想这可能是我的css,但我使用的是标准引导,我找不到任何错误
编辑:哦,这就是我检查按钮时的样子
<button type="button" text="Confirm"></button>
这是一张照片:
结束编辑:
因此,jquery的ui 1.8.22似乎不起作用,但1.8.23起作用。这是怎么回事?更改按钮定义方式:
$("#dialog-confirm").dialog({
autoOpen: false,
modal: true,
resizable: false,
height: 150,
buttons: {
"Confirm": function() {
window.location.href = targetUrl;
},
Cancel: function() {
$(this).dialog("close");
}
}
});
摘自要解决按钮问题,请根据jQuery文档或下面的示例更改脚本。此外,如果要将targetUrl传递给对话框,可以通过以下方式进行:
$(document).ready(function() {
$(".deleteLink").click(function(e) {
e.preventDefault();
var targetUrl = $(this).attr("href");
$("#dialog-confirm").dialog({
autoOpen: true,
modal: true,
resizable: false,
height: 150,
buttons: {
"Confirm": function() {
window.location.href = targetUrl;
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
return false;
});
});
你能在jsfiddle.net上发布一个演示,这样我们就可以处理它了吗?你能创建一个复制问题的fiddle吗?因此,jquery的ui 1.8.22似乎不起作用,但1.8.23起作用。这怎么可能?