简体   繁体   中英

Magento Uncaught SyntaxError: Unexpected token <

I am just adding a ticker in my website and using A script in js file . but facing error Uncaught SyntaxError: Unexpected token <

<![CDATA[<script type="text/javascript">
$(function(){
$('.simple-marquee-container').SimpleMarquee();

});
</script>]]>

Please help me

You have to remove the <![CDATA[ and ]]> . Or put it on the inside of script , with // in front, as a comment.

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

if this code is in js file then just put this code

<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

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