title: jQuery - function inside $(document).ready function
body: <p>Is it correct to create functions inside of</p>
  
  <pre><code>$(document).ready(function() {
  </code></pre>
  
  <p>like so: </p>
  
  <pre><code>$(document).ready(function() {
       function callMe() {
  
       }
   });
  </code></pre>
  
  <p>The function inside of the <code>.ready()</code> does not have to call before DOM is ready and event inside of the <code>ready()</code> is triggered.</p>
  
  <p>Just to clarify a little bit - here's the code which would illustrate the problem:</p>
  
  <pre><code>$(function() {
      var ind = 0;
  
      // some event is executed and changes the value of the ind
  
      // another event which affects the ind variable
  
      // and another one - after this event we call our function
  
  
      // there's another event - and we call our function again
  </code></pre>
  
  <p>The function which I need to call needs the updated value of the <code>ind</code> variable - which I guess I could pass as a parameter, but is there a better way of doing it?</p>
  
  <p>Also - another important thing is that the <code>function()</code> in question can also change the value of the <code>ind</code> variable - for instance incrementing it (<code>ind++</code>).</p>