6

I am trying to apply a CSS style for content inside the iframe, please check this link http://jsfiddle.net/pPqGe/

jQuery:

$(document).ready(function() {
    $('iframe').contents().find('h1').css('color','red');
});

HTML:

<iframe src="mysite" width="100%" height="100%" id="myframe"></iframe>

For iframe source I have used a live website.

Lennart
  • 9,657
  • 16
  • 68
  • 84
Vineesh Surendran
  • 137
  • 2
  • 2
  • 9

1 Answers1

7

It works. Problem is there is no H1, only H2. Check out this link http://jsfiddle.net/pPqGe/1545/.

HTML:

<iframe src='jsfiddle.net'></iframe>

JavaScript:

$(document).ready(function() {
    $('iframe').contents().find('h2').css('color','red');
    $('iframe').contents().find('#header').css('opacity','.2');
});
  • Yes you are right.It's working fine in jsfiddle, but i am using another source file for iframe. **For example:**" " it's not support. _.headline_ class is available on smashingmagazine but it would not affected. – Vineesh Surendran Apr 05 '13 at 06:33