获取元素所在的iframe对象

//获取元素所在的iframe对象
function getIframeByElement(element) {
    var iframe;
    $("iframe", window.parent.document).each(function() {
        if (element.context === $(this).prop('contentWindow').document) {
            iframe = $(this);
        }
        return !iframe;
    });
    return iframe;
}


你可能感兴趣的:(获取元素所在的iframe对象)