sveti petar
sveti petar

Reputation: 3797

Illegal Character error in jQuery - regardless of function content

First of all, I've done my research and I did find a bunch of simialr questions. However, I didn't find an answer that applies to my problem. All the examples I found were related to unescaped characters, single/double quote mishaps and the like. I on the other hand am getting this error on 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 see I commented out everything and just left an alert, and I'm still getting the error, pointing to the last line of the function. It couldn't have anything to do with other functions because I just added this one alone at the end of my current Javascript.

Can someone please tell me what's going on here? Why on Earth would a function that just alerts something (or even if it doesn't do anything) give an error?

NOTE: error is shown as soon as the page is loaded

Upvotes: 4

Views: 9335

Answers (2)

nazwie
nazwie

Reputation: 1

$('.seq_input') may used on the other functions, try using new id to do that function.

Upvotes: 0

Rob W
Rob W

Reputation: 349012

There are invisible characters between the trailing semicolon and the parenthesis. I concatenated your code, put it in a string, and called a non-existent function in order to trigger a error (using this method).

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

Upvotes: 6

Related Questions