Click event handler timing issue - onLoad and .ready
<p>I have two iframes in a page and I am trying to establish a event handler for clicks in "frame2" from inside "frame1" (both frames are in same-domain), using this code in frame1:</p>

<pre><code>$('a', parent.window.frames['frame2'].document).bind('click', onbindclick);
</code></pre>

<p>This works when called from the onload() event but not when called from .ready(). The problem with doing this in onload is that if a user clicks on a link as soon as the page starts loading (even before the onload event is fired) the event handler does not catch the click.</p>

<p>If I call <code>alert(parent.window.frames['frame2'].document)</code> from the <code>.ready()</code> function I get an "undefined" error. This I guess means that the content has not been loaded. </p>

<p>So, I am stuck. It does not work in <code>.ready()</code> and it is too late to do it in onload. What is the best way to solve this problem. Thanks for your help and time.</p>
