3
function contents_nb(name, height) {
    1. document.getElementById('contents_iframe').height = height+'px';
    2. var $currentIFrame = $('#contents_iframe'); 
    3. $currentIFrame.contents().find(".wrap_contents").hide();
    4. $currentIFrame.contents().find(".greetings").fadeIn(2500);
}

this is my jquery syntax.

no.1 ~ 3, it works well.

but line no.4, it doesn't work.

structure of html document inside iframe is ...

<body>
    <div class="wrap_contents">
        <div class="greetings">
        </div>
        <div class="operational_philosophy">
        </div>
    </div>
    </body>
    </html>

what is the reason? what causes this problem?

and syntax of the parent html document is..

<iframe id="contents_iframe"></iframe>

what is the problem?? why can not find class inside class?

baejusik
  • 71
  • 1
  • 8

1 Answers1

4

You may used jquery contents() function to access/find the elements,

$("#iframeID").contents().find("#contentID");
Krish R
  • 22,583
  • 7
  • 50
  • 59
  • that's what I used. but it doesn't work at the element inside element. – baejusik Nov 03 '13 at 10:06
  • I have tested the same, it is working fine, I have a question, what is the use of $currentIFrame.contents().find(".wrap_contents").hide(); – Krish R Nov 03 '13 at 10:55