Multiple links for one iframe don't work

Hello everyone,

I want to ask for a little bit of help.
We are building a website in wordpress where I made a iframe that needs to open multiple links.
But it only opens up the first link and after that either it stays blank or the first page only shows.

I cannot seem to get it work with jquery or with the target attribute.

Can somebody help me please.

Here is my dynamic link :

<li><a href="https://website.com/admin/editor/edit-project/?m=edit&p='. $json->projectId .'&u=1" id="toggleIframe" class="eModal-1">Edit this page</a><br class="clearfix" /></li>

And here is my iframe :

<iframe class="frame" name="main-action" width="100%" height="100%"></iframe>

And the jquery that I tried :

jQuery('.frame').attr('name', "main-action");
jQuery("#toggleIframe").each(function(){
    var el = jQuery(this);
    el.click(function() {
        jQuery(".frame").attr("src", el.attr("href"));
    })
});

jQuery('a.emodal-close').click(function() {
	jQuery(".frame").attr("src", "");
})

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.