uncaught referenceerror function is not defined in $(document).ready(function(){}
<p>I have this uncaught referenceerror function is not defined error which do not understand.</p>

<p>If I have</p>

<pre><code>$(document).ready(function(){
 function codeAddress() {
  var address = document.getElementById("formatedAddress").value;
  geocoder.geocode( { 'address': address}, function(results, status) {
   if (status == google.maps.GeocoderStatus.OK) {
    map.setCenter(results[0].geometry.location);
   }
  });
 }
});
</code></pre>

<p>and</p>

<pre><code>&lt;input type="image" src="btn.png" alt="" onclick="codeAddress()" /&gt;
&lt;input type="text" name="formatedAddress" id="formatedAddress" value="" /&gt;
</code></pre>

<p>When I press the button it will return the "uncaught referenceerror".</p>

<p>But if I put the codeAddress() <strong>outside</strong> the $(document).ready(function(){} then it working <strong>fine</strong>.</p>

<p>You can view the complete code at <a href="http://test.scoutearth.appspot.com/" rel="nofollow">http://test.scoutearth.appspot.com/</a></p>

<p>My intention is put the codeAddress() within the document.ready.function.</p>

<p>Please help me!</p>
