javascript function does not work within jquery $(document).ready block
<p>I am trying to call a javascript function from an onclick trigger.</p>

<p>html section:</p>

<pre><code>&lt;div class="my_radio"&gt;

&lt;input type="radio" name="my_radio" value="1" onclick="my_func()"/&gt;  first button

&lt;/div&gt;&lt;!-- end of class my_radio --&gt;
</code></pre>

<p>And the js/jquery section is  :</p>

<pre><code>&lt;script type="text/javascript"&gt;

$(document).ready(function(){

function  my_func(){
alert("this is an alert");

}

});

&lt;/script&gt;
</code></pre>

<p>It does not work.</p>

<p>but if i keep the js function out of the  $(document).ready section, it works. Following is the relevant code snippet:</p>

<pre><code>&lt;script type="text/javascript"&gt;

$(document).ready(function(){

function  my_func111(){
alert("this is an alert");

}

    });

function  my_func(){
alert("this is an alert");

}


&lt;/script&gt;
</code></pre>

<p>works.</p>

<p>1) Why does not the first js.jquery  code snippet work?</p>

<p>2) How can I get the first js/jquery code snippet working ?</p>

<p><strong>EDIT :</strong></p>

<p>SO FAR AS I KNOW, $(document).ready is executed when the web page loads completely. so how can I prevent my_func to be active before or after the complete page-loading if i write my_func outside $(document).ready? </p>
