简体   繁体   中英

<script> tag doesn't close properly

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">
...

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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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