开发者

javascript inline script doesn't work after jquery import from cdn

开发者 https://www.devze.com 2022-12-24 08:35 出处:网络
I\'ve got the following code: <code><html> <body><br> <script type=\"t开发者_JAVA技巧ext/javascript\" src=\"http://code.jquery.com/jquery-1.4.2.min.js\" />

I've got the following code:

<code><html>
<body><br>
<script type="t开发者_JAVA技巧ext/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>


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?


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消