2

I've got the following code:

<code><html>
<body><br>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js" />

<script type="text/javascript">

alert("debug");

</script>

</body>

</html>

And i don't know why the second script isn't loaded. I've also tried:

<html>
<body><br>
<script type="text/javascript" src="jquery.js" />

<script type="text/javascript">

  alert("debug");

</script>

</body>

 </html>
Pekka
  • 431,103
  • 135
  • 960
  • 1,075
Valentin Brasso
  • 1,397
  • 6
  • 21
  • 41

2 Answers2

3

You shouldn't use self-closing <script> tags in HTML documents, they will break in IE. Try

<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js">
</script>
Pekka
  • 431,103
  • 135
  • 960
  • 1,075
3

Try

<script type="text/javascript" src="jquery.js"></script>

instead of

<script type="text/javascript" src="jquery.js" />

See a related posting on SO

Why don’t self-closing script tags work?

Community
  • 1
  • 1
rahul
  • 179,909
  • 49
  • 229
  • 260