oleber
asked on
Changing the iframe content with jQuery
For having some big areas with scroll bars inside my web page, I'm willing to use an iframe. Maybe it isn't a good idea, open to suggestions in here.
I'm using the library jQuery, and I was considering to play with the iframe DOM from the parent window.
The child window(iframe) will not load an url. If is supposed to be changed (it has a really dynamic content) by the parent only.
Who do I change the iframe DOM?
What other solution do I have? (using just html and Javascript)
I'm using the library jQuery, and I was considering to play with the iframe DOM from the parent window.
The child window(iframe) will not load an url. If is supposed to be changed (it has a really dynamic content) by the parent only.
Who do I change the iframe DOM?
What other solution do I have? (using just html and Javascript)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I tried the following other method:
And clicking the "Page 1" anchor did not find the div and so no action or alert message.
function getContent(targetDiv, page) {
alert('Running getContent');
$.get(page, function (content) {
$(targetDiv).html(content);
});
};
....
....
<div id="content1" style="overflow:auto; width:50px; height:50px;"></div>
<a href="javascript:getContent('#content1','www.yahoo.com');return false;">Page 1</a>
And clicking the "Page 1" anchor did not find the div and so no action or alert message.
If so, you can go with an idea like bored321 says:
Open in new window