I am trying to target the body
of an iFrame with jQuery and it isn't working.
Here is the code:
HTML
<div class="editor">
<iframe id="editorf">
<body>
</body>
</iframe>
</div>
JS
$(function() {
$('#editorf').contents().find('body').css( " background-color", "none" );
});
The iFrame is located on the same domain but it is one generate by my CMS so I do not have access to it directly. How do I target the body of the iFrame and apply the css background-color:none;
?
Looks like you have an extra space in your css property string.
" background-color", "none"
Should be
"background-color", "none"
Working demo: http://jsfiddle.net/X8wDX/1/
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.