Tuesday, 28 May 2013

How to access div element by jquery on iframe?

How to access div element by jquery on iframe?

How to access div element by jquery on iframe?
I tried this (jsFiddle)
<script>

    var ifr = $("#ifr");

    $("#ifr").load(function () {
        alert($("#ifr").contents().find('#test').html());
    });

    $("#ifr").attr('src', 'http://meoooh.raonnet.com/test/oh.html');

</script>
<iframe id="ifr" width="560" height="315"></iframe>
And
I get a undefined alert.
Why I can't access div element?

No comments:

Post a Comment