<脚本> jQuery的模板内标签 [英] <script> tag inside jquery template

查看:128
本文介绍了<脚本> jQuery的模板内标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

研究背景:

我有这个模板,其中包括来自YouTube视频加载与SWFObject的。

问:

有没有一种办法,包括脚本标记...

 <脚本类型=文/ JavaScript的>
< / SCRIPT>
 

里面一个jQuery模板??

 <脚本ID =filaVideoTemplate类型=文/ X-的jQuery TMPL>
    <! - 一些HTML这里 - >
    <脚本类型=文/ JavaScript的>
        <! - 一些JavaScript在这里 - >
    < / SCRIPT>
< / SCRIPT>
 

显然,它并不直接工作,有什么办法才达到同样的事情,里面没有其他脚本,该脚本?

解决方案

 <脚本ID =filaVideoTemplate类型=文/ X-的jQuery TMPL>
    <! - 一些HTML这里 - >
    <脚本类型=文/ JavaScript的>
        <! - 一些JavaScript在这里 - >
    {{的html&所述; / SC+RIPT>中}}
< / SCRIPT>
 

您可以使用{{HTML< / SC+RIPT>}}代替< / SCRIPT>

Backgroud:

I have this template that includes videos from youtube being loaded with swfobject.

Question:

Is there a way to include a script tag...

<script type="text/javascript">
</script>

inside a jQuery Template??

<script id="filaVideoTemplate" type="text/x-jQuery-tmpl">
    <!-- Some HTML here -->
    <script type="text/javascript">
        <!-- Some javascript here -->
    </script>
</script>

Obviously it doesn't work directly, is there any way to achive the same thing without the script inside other script?

解决方案

<script id="filaVideoTemplate" type="text/x-jQuery-tmpl">
    <!-- Some HTML here -->
    <script type="text/javascript">
        <!-- Some javascript here -->
    {{html "</sc"+"ript>"}}
</script>

You can use {{html "</sc"+"ript>"}} replace </script>

这篇关于&LT;脚本&GT; jQuery的模板内标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆