Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
354 views
in Technique[技术] by (71.8m points)

php - Why is $(document).ready not firing for me?

In a php file i have used include to include the following js.php file and prior to that i have included the jquery file.

<script type="text/javascript">

$(document).ready(function(){
     alert("hello");
});
</script>

But it doesn't work. Why? when I skip the $(document).ready function it works.

But i need jquery code inside. what is wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The most likely answer, based on what you have said, is that the core jQuery file is not actually included correctly in the page. You need something like:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

Chances are, this is missing or typed incorrectly.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...