javascript - Appending div to iframe -
what wrong piece of code:
jquery('<iframe id="groundplan_popup" class="groundplan_hidden" />').appendto("#popup_holder"); var iframe = jquery("#groundplan_popup"); iframe.attr("src","::censored::" + filename); var iframe_body = iframe.contents().find('body').append('<div id="groundplan_popup_exit"></div>'); var exit_btn_gp = iframe_body.append(jquery("#groundplan_popup_exit"));
so have dynamically create iframe element open .pdf file in popup , part works. can't manage create div id of "groundplan_popup_exit" within iframe. don't know why doesnt' work , i'm doing wrong. when inspect iframe window console brings out warning:
/deep/ combinator deprecated. see https://www.chromestatus.com/features/6750456638341120 more details.
dont know if has reason why isn't working.
edit:
iframe console elements prtscr:
so i'm confused whole situation i'm not experienced in using jquery in general , first time using iframes. i'm not sure if #groundplan_popup_exit div created , how find if is.
i see problems:
var iframe_body = iframe.contents().find('body').append('<div id="groundplan_popup_exit"></div>');
here appending element body.
var exit_btn_gp = iframe_body.append(jquery("#groundplan_popup_exit"));
after have appended above, trying append again jquery("#groundplan_popup_exit")
not exists.
fix (untested) this:
var iframe_body = iframe.contents().find('body'); var exit_btn_gp = iframe_body.append('<div id="groundplan_popup_exit"></div>');
Comments
Post a Comment