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
  • 442,112
  • 142
  • 972
  • 1,088
Valentin Brasso
  • 1,388
  • 7
  • 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
  • 442,112
  • 142
  • 972
  • 1,088
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
  • 184,426
  • 49
  • 232
  • 263