I am trying to check the css style of an element inside of an iframe but cannot seem to find the element.
It works fine if not inside the iframe so has to be with the way I am finding the content in the iframe.
Here is a jsFiddle
var iframe = document.createElement('iframe');
var html = '<body><div id="cadrage" style="color:black">Test</div></body>';
iframe.src = 'data:text/html;charset=utf-8,' + encodeURI(html);
document.body.appendChild(iframe);
$('iframe').ready( function() {
if( $('iframe').contents().find("#cadrage").css('color') == "rgb(0, 0, 0)" ) {
alert('It equal');
} else {
alert('It did not equal');
}
});