我遇到下面的代码有问题。基本上它的功能是2部分...JQuery功能代码没有正常运行
第1部分只需点击提交按钮,第2部分显示一个对话框。
由于某些原因,两个部分单独运行,但在函数中添加时没有对话框出现,所以当第2部分不能运行时。
语法问题?
下面的代码:
function myfunction() {
$('input[type=submit]#mysubmit').click();
$("#info").dialog({
autoOpen: false,
modal: true,
width: 400,
zIndex: 9999999,
resizable: false,
buttons: [
{
text: "Close",
click: function() {
$(this).dialog("close");
}
}
]
});
}
更新:我已经试过注释掉第1部分和对话仍然没有露面所以它的东西做的对话框代码...第2部分
见下文:
function myfunction() {
//$('input[type=submit]#mysubmit').click(); //commented out
$("#info").dialog({
autoOpen: false,
modal: true,
width: 400,
zIndex: 9999999,
resizable: false,
buttons: [
{
text: "Close",
click: function() {
$(this).dialog("close");
}
}
]
});
}
你是否阻止表单提交(导致页面重新加载)当你点击提交按钮? – 2012-01-08 12:28:33
请参阅更新...它似乎是第2部分。出现问题的对话框部分 – Satch3000 2012-01-08 12:34:26
删除'autoOpen:false'。 – 2012-01-08 12:35:01