问题描述
|
Simplemodal可以完美运行,但是我不知道提交表单后如何自动关闭iframe。
我试图使用js将事件置于模式选项之外,但是
如果我关闭Submit事件的模式窗口,则不会提交表单...
我还向输入按钮添加了类simplemodal-close,但它不能以这种形式工作?
有什么建议么??
这是我的代码
//模态窗口
modal.click(function(e){
e.preventDefault();
$.modal(\'<iframe src=\"\' + this.href + \'\" height=\"480\" width=\"525\" style=\"border:0\" >\',{
containerCss:{
backgroundColor:\"#fff\"
},overlayClose:true,onShow: function (dialog) {
$(\"input\",dialog.data).click(function (e) {
e.preventDefault();
alert(\'Here\'); //Doesnt execute
$.modal.close();
parent.$.modal.close();
alert(\'Here\');
});
}
});
解决方法
好的,我就是这样做的。.我没有使用iframe,因为在parent。$。modal.close()之后。.iframe中包含的js不再执行了。
所以我就是这样做的。
//Modal Window
modal.click(function(e){
e.preventDefault();
$.get(this.href,function(data){
var resp = $(\'<div></div>\').append(data); // wrap response
$(resp).modal({
overlayClose:true,minHeight:450,minWidth: 500,containerCss:{
backgroundColor:\"#fff\",borderColor:\"#fff\"
},onShow: function(dialog){
autocomplete();
}
});
});
});
如果我使用div而不是iframe,则在我提交时,模式将关闭,否则它将保持打开状态。
这很容易,但是我很困惑。