简体   繁体   English

无法在NetBeans中包含jQuery

[英]Can't include jquery in netbeans

When I include a jQuery file like as follows in Netbeans, my code doesn't work: 当我在Netbeans中包含如下所示的jQuery文件时,我的代码不起作用:

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

whereas it works when I proceed as the following: 而当我按以下步骤进行时它起作用:

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

Does anyone has an idea why? 有谁知道为什么?

You need to import jQuery, first, followed by your custom script file. 首先,需要导入jQuery,然后导入自定义脚本文件。 If this order is reversed, your script will not run 如果此顺序相反,您的脚本将无法运行

<script type="text/javascript" src="../JS/jquery-1.11.3.min.js"></script>
<script src="script.js"></script> 

Try to check if you have the privilege for open the jquery file. 尝试检查您是否具有打开jquery文件的特权。 If you have only read permission change it. 如果您只有阅读权限,请更改它。

I had this same issue with the page being blank. 页面出现空白时,我遇到了同样的问题。 I found that closing the tags like with the full </script> fixes the problem instead of / > . 我发现关闭像完整的</script>这样的标签可以解决问题,而不是/ >

Before I had it like <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" /> 之前,我喜欢<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" />

Seems Netbeans has an issue with shorthand closing of tags. 似乎Netbeans存在速记标签关闭的问题。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM