2

What is wrong with this sample code? o_O

<html>
    <head>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                console.log("Testing");
                $('#test').append("Test");​
            });
        </script>
        <title>Sin título 4</title>
</head>
<body>

    <div id="test">Hello world.</div>

</body>
</html>
7
  • It says that error happens in line 9: $('#test').append("Test");​ Commented Jul 12, 2012 at 2:57
  • 2
    That code works jsfiddle.net/2hDbL Commented Jul 12, 2012 at 3:00
  • Apparently not in my IDE editor... phpDesigner on my localhost.. WAMP. Commented Jul 12, 2012 at 3:00
  • 1
    I wouldn't trust any IDE for debugging JavaScript. Trust the browsers. Commented Jul 12, 2012 at 3:02
  • Yes... my Chrome browser is giving the error. Commented Jul 12, 2012 at 3:03

1 Answer 1

22

You have an illegal invisible character at the end of this line...

$('#test').append("Test");​// <-- right before this comment

Delete the line entirely, and retype it, or make sure the cursor is after all characters on the line, and hit backspace until you see characters actually being removed.

This happens sometimes if you copy & paste code from jsFiddle.

The charCode of the offending character is 8203.

Sign up to request clarification or add additional context in comments.

2 Comments

How would one go about finding these illegal text characters themselves?
@Prusprus: Here's a SO question that may help. I don't have much better than that to offer. Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.