Illegal character error in jQuery - regardless of function content

First of all, I did my research and I found a bunch of simialr questions. However, I did not find an answer that concerns my problem. All the examples I found were related to unescaped characters, single / double quotes, etc. I, on the other hand, get this error from the following function:

$('.seq_input').blur(function(){ //var id = $(this).data('id'); //var index = parseInt($(this).val()), //element = $("#test-list li").eq(id).remove(); //$("#test-list li").eq(index - 1).before(element); // -1 because users like 1 based indices alert('what?'); })​​​; 

As you can see, I commented everything and just left a warning, and I still get an error message pointing to the last line of the function. This could have nothing to do with other functions, because I just added this one at the end of my current Javascript.

Can someone please tell me what is going on here? Why would there be a function on Earth that simply warns something (or even if it does nothing) gives an error?

NOTE: an error is displayed as soon as the page loads.

+4
source share
2 answers

There are invisible characters between the end semicolon and brackets. I concatenated your code, put it on a line, and called a nonexistent function to raise an error (using this method ).

 '})​​​;'.l() >>> TypeError: "})\u200B\u200B\u200B;".l is not a function 
+6
source

$('.seq_input') can be used for other functions, try using a new identifier to execute this function.

0
source

All Articles