开发者

JavaScript src with empty tag works, with empty end doesn't [duplicate]

开发者 https://www.devze.com 2023-03-26 10:47 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Why don't self-closing script tags work?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Why don't self-closing script tags work?

I am using Spring web-mvc with F开发者_开发百科reemarker and JQuery. The following works fine (layout, positioning etc):

<script type="text/javascript" src="<@spring.url 'jquery.ui.core.js'/>"></script>

But this doesn't:

<script type="text/javascript" src="<@spring.url 'jquery.ui.core.js'/>"/>

What's going wrong?


Nothing is wrong, script tags just require the closing tags, they can't be self closed.

More discussion about it available on this thread: Why don't self-closing script tags work?


You can't close a script tag using '/>' you have to use the explicit '</script>' closing tag.

0

精彩评论

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

关注公众号