JQUERY gotcha, Why can't I change inside an iframe that is hosted locally?

Posted by nobosh on Stack Overflow See other posts from Stack Overflow or by nobosh
Published on 2010-04-16T22:10:41Z Indexed on 2010/04/16 22:13 UTC
Read the original article Hit count: 198

Filed under:
|
|
|
|

Give the following on a page:

<iframe frameborder="0" allowtransparency="true" tabindex="0" src="" title="Rich text editor" style="width: 100%; height: 100%;" id="hi-world">
<p><span class="tipoff" title="System tooltip for search engines">Download now</span></p><p>adasdads</p><p>a</p><p><span class="tipoff" title="System tooltip for search engines">Download n1111ow</span></p>
</iframe>

The following works:

$('#hi-world').css("width","10px");

But what I want to do is change the paragraphs in the iFrame, and this does not work:

$('#hi-world').find('p').css("background","red");

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about iframe