Reputation: 483
I am trying to get body content of iframe
using either Javascript or jQuery. I have tried to solve the problem several ways, but none of them worked for me.
The solutions I tried looked like these:
document.getElementById('iframe').document.innerHTML;
$("#content").contents().find("body").html();
Upvotes: 0
Views: 324
Reputation:
document.getElementById("iframe").contentWindow.document.body.innerHTML
Upvotes: 3
Reputation: 733
If the iframe is from the same domain, you could do an $.ajax
request on the URL that is the iframe src url?
Upvotes: 1