title: using jQuery outside of $(document).ready()
body: <p>I have created a function outside of <code>$(document).ready()</code>, but am still using jQuery inside of it. For example:</p>
  
  <pre><code>testFunction(){
    $('#test').hide();
    alert('test');
  }
  </code></pre>
  
  <p>When I call <code>testFunction()</code> after the page has completely loaded, #test is not hidden but I do see the alert.</p>
  
  <p>What must I do in order to use jQuery inside of this function? Thanks!</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Good to understand there are no restrictions for working outside <code>$(document).ready()</code>.</p>
  
  <p>Here's why it's not working: I am not calling <code>testFunction()</code>, I am calling <code>parent.testFunction()</code> from an iframe and #test is in the parent frame. So... I guess I cannot use '#test' as a selector. What should I be using?</p>