Reputation: 11
How can I call a javaScript function present in a child <iframe>
node from the parent? I am using jquery selector to select the correct iframe node but do not know how to call the function. Also the desired iframe has been added dynamically using jquery.
For example, the iframe is
<iframe id="frameOne" src="http://form_one.html"><iframe>
I need to do something like this
$(#frameOne).submitList();
where submitList()
is a function in form_one.html.
Thanks.
Upvotes: 1
Views: 11882
Reputation: 1977
document.getElementById('frameOne').contentWindow.submitList();
frameOne should be the ID of the frame!
Upvotes: 6
Reputation: 146310
As long as both of the URLs are in the same domain it should work.
If they are not, then you run into cross-domain issues
Upvotes: 0