AccidentallyC
AccidentallyC

Reputation: 92

Jquery - identical codes but only one of them works

Consider code A and code B. They look identical but one is written by me. The other, copy pasted from W3. Code A (the one written by me) doesn't work but Code B does. Why is this? I've done a string match and it says it doesn't match but putting them ontop of each other in notepad (the code being one line already) reveals that its not different at all. Is there anything i'm doing wrong?

Code A:

$(document).ready(function(){
$(".sub").click(function(){
$(".sub").slideToggle("slow");
  });
​});

Code B:

$(document).ready(function(){
$(".sub").click(function(){
$(".sub").slideToggle("slow");
  });
});

Upvotes: 3

Views: 183

Answers (1)

Metro Smurf
Metro Smurf

Reputation: 38335

Before the edit was done on the post, the curly bracket on the last line in Code A has a different type of character set than the curly bracket in Code B. You can see this when doing a diff compare.

Copy/Paste the original into Notepad++ and you'll see the difference as well.

Code A: ?});

Code B: });

EDIT
It looks like the 2 characters are the entity of ​ and }. Take a look at the SO Question: What's HTML character code 8203?

Upvotes: 4

Related Questions