I'm trying to pull an html variable from an iframe which is inside another div inside the iframe.
Here is the excerpt of the code I'm using:
var myVariable = $('#iframe-id').contents().find('.variable-inside').html();
The iframe has been give an id (#iframe-id) and the variable is inside "variable-inside" which is rendered inside the iframe.
For some reason this isn't working for me. Is there a problem with the code?
I'm aware this method can be used if both documents are on the same domain (iframe doc and other doc) but I can still use it if it's on the same domain, just different subdomains correct? Eg: iframe doc is at lorem.example.com and other doc is at ipsum.example.com)
Any help would be great. Thanks.