JavaScript error when opening page - Uncaught SyntaxError

3

When I open the page it breaks and when I open the browser console the following error appears:

Uncaught SyntaxError: Unexpected token ;

When I see the code on the console it looks like this:

if (linhaAnterior$.size() > 0) {}

But my code actually looks like this:

if (linhaAnterior$.size() > 0) {}

I have other if s in this code but only in this does this change occur when I open the page.

    
asked by anonymous 08.04.2015 / 15:01

1 answer

2

Since you are using XHTML, you need to encapsulate the javascript code with CDATA, as follows:

    <script type="text/javascript">
    // <![CDATA[
        ...
    // ]]>
    </script>

However, we recommend separating the javascript code into another file:

    <script type="text/javascript" src="/pasta/script.js"></script>

To learn more, see link .

    
09.04.2015 / 07:43