javascript - invalid character error with jquery and highcharts SCRIPT1014: Invalid character - Stack Overflow

Trying to do a really basic highchart, but I keep getting the error:"JavaScript critical error a

Trying to do a really basic highchart, but I keep getting the error: "JavaScript critical error at line 42, column 12. SCRIPT1014: Invalid character. I have included jQuery in the header so I'm not sure what I'm doing wrong. Testing with IE.

<!DOCTYPE html>

<html xmlns="">
<head>
    <script src=".8.2/jquery.min.js">  </script>
    <script src=".js"></script>
    <title></title>
</head>
<body>
    <div id="container" style="width:100%; height:400px;"></div>
    <script type="text/javascript">
        $(function () { 
            $('#container').highcharts({
                chart: {
                    type: 'bar'
                },
                title: {
                    text: 'Fruit Consumption'
                },
                xAxis: {
                    categories: ['Apples', 'Bananas', 'Oranges']
                },
                yAxis: {
                    title: {
                        text: 'Fruit eaten'
                    }
                },
                series: [{
                    name: 'Jane',
                    data: [1, 0, 4]
                }, {
                    name: 'John',
                    data: [5, 7, 3]
                }]
            });
        });​
    </script>    
</body>
</html>

Trying to do a really basic highchart, but I keep getting the error: "JavaScript critical error at line 42, column 12. SCRIPT1014: Invalid character. I have included jQuery in the header so I'm not sure what I'm doing wrong. Testing with IE.

<!DOCTYPE html>

<html xmlns="http://www.w3/1999/xhtml">
<head>
    <script src="http://ajax.googleapis./ajax/libs/jquery/1.8.2/jquery.min.js">  </script>
    <script src="http://code.highcharts./highcharts.js"></script>
    <title></title>
</head>
<body>
    <div id="container" style="width:100%; height:400px;"></div>
    <script type="text/javascript">
        $(function () { 
            $('#container').highcharts({
                chart: {
                    type: 'bar'
                },
                title: {
                    text: 'Fruit Consumption'
                },
                xAxis: {
                    categories: ['Apples', 'Bananas', 'Oranges']
                },
                yAxis: {
                    title: {
                        text: 'Fruit eaten'
                    }
                },
                series: [{
                    name: 'Jane',
                    data: [1, 0, 4]
                }, {
                    name: 'John',
                    data: [5, 7, 3]
                }]
            });
        });​
    </script>    
</body>
</html>
Share Improve this question asked Jul 2, 2013 at 14:57 tujtuj 6052 gold badges11 silver badges26 bronze badges 1
  • works fine here... try copy/pasting it to a simple text file... you probably copied a invalid character from somewhere (if you used copy/paste to add the JS code) – Iansen Commented Jul 2, 2013 at 15:05
Add a ment  | 

3 Answers 3

Reset to default 3

I got a special character '?' when I copy your code just after the last semicolon. Try to copy your code in a text editor (notepad++ for me), remove this character and copy again your page.

It has worked for me.

I took out the very last ";" in the jQuery block of code and it worked. Weird...

In the future I advice to use jslint which check your syntax.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745004989a4605725.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信