开发者

Javascript: script reference with no children not working

开发者 https://www.devze.com 2023-03-17 08:18 出处:网络
I was trying to make a jQuery templates example work on a SharePoint web part.开发者_StackOverflow

I was trying to make a jQuery templates example work on a SharePoint web part.

开发者_StackOverflow

I narrowed my problem down to the following:

This WORKS:

<script type="text/javascript" src="/_layouts/ServerComponents/jquery-latest.min.js" ></script>
<script type="text/javascript" src="/_layouts/ServerComponents/jquery.tmpl.min.js" ></script>

but this DOESN'T:

<script type="text/javascript" src="/_layouts/ServerComponents/jquery-latest.min.js" />
<script type="text/javascript" src="/_layouts/ServerComponents/jquery.tmpl.min.js" />

Why? Thanks!


Because script is not a self-closing tag. You always need the closing tag.

See the specification:

Start tag: required, End tag: required

0

精彩评论

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

关注公众号