0

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

Sanjay Yadav
  • 243
  • 3
  • 20

2 Answers2

1

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.

Community
  • 1
  • 1
eisbehr
  • 12,243
  • 7
  • 38
  • 63
  • this code also showing same error – Sanjay Yadav Sep 21 '16 at 13:42
  • We would need more info then. Where have you included the code? Is the snippet really the problem? Are there more error details? Please edit your question with more information. @SanjayYadav – eisbehr Sep 21 '16 at 13:46
  • I have no more error I am including page link please view this and if need more any thing from my side then let me know please.(http://dev.factorydirectmedical.com/?) – Sanjay Yadav Sep 21 '16 at 13:48
  • Took a short look. Your HTML is full of bugs, like unclosed tags. So clean up the HTML first, that may solve the problem or you will better see whats wrong. Actually your page is a mess. @SanjayYadav – eisbehr Sep 21 '16 at 14:01
0

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

Murtuza Zabuawala
  • 318
  • 11
  • 17