[英]Magento Uncaught SyntaxError: Unexpected token <
I am just adding a ticker in my website and using A script in js file . 我只是在我的网站上添加一个代码,并在js文件中使用脚本。 but facing error Uncaught SyntaxError: Unexpected token <
但面临错误未捕获的SyntaxError:意外的令牌<
<![CDATA[<script type="text/javascript">
$(function(){
$('.simple-marquee-container').SimpleMarquee();
});
</script>]]>
Please help me 请帮我
You have to remove the <![CDATA[
and ]]>
. 您必须删除
<![CDATA[
and ]]>
。 Or put it on the inside of script
, with //
in front, as a comment. 或将其放在
script
内部( //
放在前面)作为注释。
<script type="text/javascript">
$(function() {
$('.simple-marquee-container').SimpleMarquee();
});
</script>
or 要么
<script type="text/javascript">
//<![CDATA[
$(function() {
$('.simple-marquee-container').SimpleMarquee();
});
//]]>
</script>
See also, when and why CDATA
is needed . 另请参阅何时和为何需要
CDATA
。
if this code is in js file then just put this code 如果此代码在js文件中,则只需将此代码放入
<script type="text/javascript">
$(function() {
$('.simple-marquee-container').SimpleMarquee();
});
</script>
we use CDATA when we add js in xml file directly as per I know May be I was wrong this is the concept 当我们直接在xml文件中添加js时,我们使用CDATA,我知道这可能是我错了,这是概念
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.