[英]Difference between <script /> and <script></script> for importing multiple js file in HTML
This issue I recently faced, I was trying to import multiple js files in my HTML page like this - 我最近遇到的这个问题,我试图像这样在HTML页面中导入多个js文件-
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore.js" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js" />
<script src="lib/js/backbone.js" />
But the issue I was facing is, it was loading only the first js file and the rest of the js file was not getting loaded. 但是我面临的问题是,它仅加载第一个js文件,而其余js文件未加载。 I also checked the network section in the browser, the remaining two file was just not getting called. 我还检查了浏览器中的网络部分,剩下的两个文件没有被调用。 Then I changed the syntax to this - 然后我将语法更改为此-
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<script src="lib/js/backbone.js"></script>
And then the loading of all the 3 files happened successfully. 然后,所有3个文件的加载成功完成。 My question is, is 我的问题是
<script src="" />
a wrong syntax or is this issue only specific to me? 错误的语法,或者此问题仅特定于我?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.