jQuery如何从在iFrame中创建的表单提交读取事件

时间:2017-03-12 07:05:40

标签: javascript jquery html forms iframe

我有一个问题;我试图创建一个通用的方法来显示WebPage中的对话框界面,这个对话框界面将包含一个iFrame(调用任何外部WebPage - ASPX)。在iFrame中加载的WebPage将包含一个表单。

我的目的是阅读活动"提交"从主网页在iFrame中创建的表单。

基本上,我在主WebPage中有这个方法:

$('#' + dialogId).contents().find('iframe').load(function (element) {
    $(element.currentTarget.contentDocument).find("form").on("submit", function (e) {
        alert('Form!!')
    });
});

我已经有一个dialogId(DIV元素在所有页面中叠加,iFrame在里面)

0 个答案:

没有答案