Cannot modify content of iframe, what is wrong?

Please don't forget the cross-domain policy, otherwise it won't work.

Live demo: http://jsfiddle.net/oscarj24/wTWjF/

(Just to know, I am not using a 404 page, take a look)

Try this:

$(document).ready(function(){
    $('#ifr').ready(function(){
        $(this).contents().find('body').html('Hey, I have changed the body content yay!');
    });
});​

Assuming you are honoring the cross-domain policy, this sounds like a timing issue. Chances are your iframe has already finished loading when the document.ready of the parent page fires.

You could try changing your frame.load to frame.ready as .ready will fire immediately if it is bound after the ready event has already triggered.

Tags:

Html

Jquery