views:

78

answers:

1

From one page, I call fancybox to open an iframe in the fancybox. From that page, the one in the fancybox, I try to write some more jQuery code.

$(document).ready(function() {});

is not called if my jQuery code is in the head tag, but if my jQuery code is written before anything, even the DOCTYPE, then it works. Why is this?

Thanks in advance.

+1  A: 

Not sure I completely understand the question, but accessing content inside of an iframe with jQuery is a bit different than you may expect. You need to call similar to the following to interact with iframe content.

$('#iFrame').contents().append('<div>Hello World</div>');

reference: http://simple.procoding.net/2008/03/21/how-to-access-iframe-in-jquery/

HurnsMobile