Jitender
Jitender

Reputation: 7971

jquery .contents method?

i have html page in which i am using iframe and calling antoher page name "jj.html" in jj html i have one more iframe within it now i want to add some css properties in it without toching jj.html page so i write small function and use .contents method but it is not working.

http://jsfiddle.net/WdvNn/

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
    <script type="text/javascript" src="jquery/jquery-1.7.min.js"></script>    
    <script type="text/javascript">
        $(function () {     
            $('#test').contents().find('iframe').css('display','block');        
        })    
        </script>    
</head>    
<body>    
    <iframe width="100%" height="600" allowtransparency="yes" frameborder="0" src="jj.html" id="test"></iframe>
</body>

Upvotes: 0

Views: 111

Answers (1)

Daxcode
Daxcode

Reputation: 434

are all iFrame contents located in the same domain?

If not, it might not work, regarding the Same Origin Policy.

Upvotes: 1

Related Questions