<脚本>标签未正确关闭 [英] <script> tag doesn't close properly
本文介绍了<脚本>标签未正确关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的default.jspx中,它包含页面的基本布局,我试图导入一些jquery库,如下所示
In my default.jspx which contains the basic layout for the page I am trying to import some jquery libraries as follows
<head>
...
<spring:url value="/resources/js/lib/jquery-1.9.1.min.js" var="jquery_url" />
<spring:url value="/resources/js/lib/jquery.tokeninput.js" var="jquery_tokeninput_url" />
<script src="${jquery_url}" type="text/javascript"></script>
<script src="${jquery_tokeninput_url}" type="text/javascript"></script>
<script type="text/javascript">
$.noConflict();
</script>
<util:load-scripts />
...
</head>
但是当页面在浏览器中呈现时,第一个脚本标签会吞下其他两个
but when the page is rendered in the browser the first script tag swallows the two others
<head>
...
<script type="text/javascript" src="/roo-inari/resources/js/lib/jquery-1.9.1.min.js">
//These lines are inside the first script tag
<script type="text/javascript" src="/roo-inari/resources/js/lib/jquery.tokeninput.js"/>
<script type="text/javascript">
$.noConflict();
//The tag is closed here
</script>
<link href="/roo-inari/resources/dijit/themes/tundra/tundra.css" type="text/css" rel="stylesheet">
...
知道可能导致这种情况的原因吗?该项目基于spring roo生成的web mvc脚手架。
我正在使用Chrome v.25。
Any idea what might be causing this? The project is based on a spring roo generated web mvc scaffold. I am using Chrome v.25.
推荐答案
简单的解决方案是在标记内写一条注释,以便它没有自动关闭。傻我
The simple solution was to write a comment inside the tag so that it is not closed automatically. Silly me
<script src="${jquery_url}" type="text/javascript"><!-- required for some browsers --></script>
这篇关于<脚本>标签未正确关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文