Reputation: 8307
I have a div with id "test". Inside it is an iframe which has no id. I need to access the body contents of this iframe. How to do it using JS/Jquery?
Upvotes: 1
Views: 5926
Reputation: 2377
Access it like this:
$('#test>iframe').contents.find('body') // This will get you body tag
Upvotes: 1
Reputation: 82241
jquery will do it.
var objiframe=$('#test').find('iframe');
you'll get iframe
in objiframe
then use objiframe
with selector to get or set attribute and contents of iframe.
Upvotes: 0