简体   繁体   中英

How to reference a div from inside of an iframe?

So i have this type of structure:

<div id="status"></div>

<div id="main">
       <iframe src="something" id="myframe"></iframe>
</div>

I want to click something inside a frame and have a jquery call affect the 'status' div. Where would I place this Jquery call $('#status').css('background', 'red') . Thanks

$('#status', window.parent.document).css('background', 'red')

Try that

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM