jquery库不能在外部php文件中工作

I have any page and included jquery library and css to this (index).

Now I have code for twitter like load more. This worked but when I need to delete this using jQuery it is not working ( with another code in my index ). problem this : jquery library is not appended to the external php file.

I have same problem in colorbox. when I load iframe in colorbox my index jQuery not appended to external files so I put manual jquery to external files!

There is no way that only used the jquery original file(my index) ?

E.X js load more :

<script type="text/javascript">
$(function() {
//More Button
$('.more').live("click",function() 
{
var ID = $(this).attr("id");
if(ID)
{
$("#more"+ID).html('<img src="moreajax.gif" />');

$.ajax({
type: "POST",
url: "ajax_more.php",
data: "lastmsg="+ ID, 
cache: false,
success: function(html){
$("ol#updates").append(html);
$("#more"+ID).remove();
}
});
}
else
{
$(".morebox").html('The End');

}


return false;


});
});

</script>

PHP :

 <?php
include("config.php");


if(isSet($_POST['lastmsg']))
{
$lastmsg=$_POST['lastmsg'];
$result=mysql_query("select * from messages where msg_id<'$lastmsg' order by msg_id desc limit 9");
$count=mysql_num_rows($result);
while($row=mysql_fetch_array($result))
{
$msg_id=$row['ms_gid'];
$message=$row['message'];
?>


<li>
<?php echo $message; ?>
</li>


<?php
}


?>

<div id="more<?php echo $msg_id; ?>" class="morebox">
<a href="#" id="<?php echo $msg_id; ?>" class="more">more</a>
</div>

<?php
}
?>

HTML :

    <head><script type="text/javascript" src="./jquery.min.js"></script></head>
    <div id='container'>
    <ol class="timeline" id="updates">
    <?php
    $sql=mysql_query("select * from messages ORDER BY msg_id DESC LIMIT 9");
    while($row=mysql_fetch_array($sql))
    {
    $msg_id=$row['msg_id'];
    $message=$row['message'];
    ?>
    <li>
    <?php echo $message; ?>
    </li>
    <?php } ?>
    </ol>
    <div id="more<?php echo $msg_id; ?>" class="morebox">
    <a href="#" class="more" id="<?php echo $msg_id; ?>">more</a>
    </div>
    </div>

Is is because your jquery is loaded after the document is ready then you call the other php file. You should use jquery functions without $(document).ready(); so you will be able to use jquery functions everywhere. The other important thing is that instead of using

$(function(){
    $('#selector').click(function(){
       'your other code'  

    });
});

use like this

function my_function(){
  your code
}

and html

<input type = "text" onclick = 'my_function();'>

Hope this will help. This way you will be able to call these functions everywhere. And if you are calling or loading the other php file in the first php then make sure it is loaded in a div which resides in the first php file.