Reputation: 44155
I am digging deep into a page's DOM to manipulate a certain image attribute. I have a web page which contains an iFrame. The iFrame contains an image. The image has no id attribute so I am going to locate it using it's src. The src contains the unique keyword 'planet'. How do I locate this image using jQuery?
ADDITION:
I can't reference anything in the iFrame's DOM. Is there a special way to reference an element inside an iFrame?
Example: alert( $(myIframe).find('html').length ) reports 0, expecting 1.
Upvotes: 0
Views: 196
Reputation: 186662
I don't think you can manipulate iframe contents if the iframe's domain is not one you have control over.
EDIT: Since you said that it IS from the same domain now, $('#id').contents().find('a')
should work.
Upvotes: 1