Friends, My issue is that my page is really slow to load, because all of the load simeltaneously. I am pulling an RSS feed that if you click on the \"article\" button it w
First, you don't have an element $('#gogogo'). The frame is #gogo.
Second, set it's src not href
$("#myframe").attr('src', 'http://site.com');
If you just want to set it to some HTML and not a URL, use this:
$("#myframe").contents().find('html').html("hello");
Here's a demo
Html:
<iframe id="myiFrame" data-src="http://my.url" src="about:blank">
</iframe>
In your jQuery:
$("button").click(function(){
var iframe = $("#myiFrame");
iframe.attr("src", iframe.data("src"));
});
Or if you wanted to load ALL iframes when you click one button... make sure they all have a data-src="your.url" attribute, and then loop through like this:
$("button").click(function(){
$("iframe").each(function(){
$(this).attr("src", $(this).data("src"));
});
});
<a href="http://example.com" target="myiFrame">Click me!</a>
<iframe name="myiFrame" src="about:blank">
No JavaScript required.