此jquery中的按钮未显示;
function jqcall() {
$(document).ready(function () {
var dlg1 = $("#dialog").dialog({
width: 1250,
height: 575,
autoOpen: false,
buttons: {
'Ok': function () {
$("[id*=Button1]").click();
},
'Close': function () {
$(this).dialog('close');
}
}
});
dlg1.parent().appendTo($("form:first"));
});
}
最初此对话框在Gridview中的clickig链接按钮上打开,并且保存按钮在gridview中不起作用;它回发到服务器并且没有显示任何错误,但数据没有保存到数据库。
答案 0 :(得分:0)
请注意使用初始化程序选项:
position: { my: "left top", at: "left top", of: $("#divId") }
appendTo: "#divId"
#divId
元素中。与position
类似,modal: true
$(document).ready(function() {
var dlg1 = $("#dialog").dialog({
width: 1250,
height: 575,
position: { my: "left top", at: "left top", of: $("#divId") },
autoOpen: false,
//appendTo: "#divId",
//modal: true,
closeText: "hide",
title: "Dialog Title",
buttons: [{
text: "Ok",
icons: { primary: "ui-icon-heart" },
click: doSomething
}, {
text: "Close",
icons: { primary: "ui-icon-heart" },
click: () => $(this).dialog('close')
}]
});
$("#dialog").dialog( "open" );
});
$("[id*=Button1]").click(doSomething);
function doSomething() {
console.log("Something");
}
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
<div id="divId"></div>
<div id="dialog"></div>
答案 1 :(得分:0)
$(function() {
$('#clickMe').click(function(event) {
var mytext = $('#myText').val();
$('<div id="dialog">'+mytext+'</div>').appendTo('body');
event.preventDefault();
$("#dialog").dialog({
width: 600,
modal: true,
close: function(event, ui) {
$("#dialog").remove();
}
});
}); //close click
});
&#13;
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
<h3 id="clickMe">Open dialog</h3>
<textarea cols="0" rows="0" id="myText" style="display:none">Some hidden text display none</textarea>
&#13;