Question

What does the character code (HTML) ​? I found it in one of my jQuery scripts and wondered what it was..

Thanks.

Edit:

Here is the script it was in (it was added to the end, found it in Firebug)

<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript">
var $jnyh = jQuery.noConflict();


$jnyh(function() {
    $jnyh("#title-nyh").click(function() {
      $jnyh(".show-hide-nyh").slideDown("slow");
    }, function() {        
      if(!$jnyh(this).data('pinned'))
        $jnyh(".show-hide-nyh").slideUp("slow");
    });
    $jnyh("#title-nyh").click(function() {
    $jnyh(this).parent().toggleClass("title-btm-brdr");
       $jnyh(this).toggleClass("chev-up-result");
      var pin = $jnyh(this).data('pinned');
      $jnyh(this).data('pinned', !pin);
      if(pin) $jnyh(".show-hide-nyh").slideUp("slow");      
    });
});​&#8203;
</script>
Was it helpful?

Solution

It's the Unicode Character 'ZERO WIDTH SPACE' (U+200B).

this character is intended for line break control; it has no width, but its presence between two characters does not prevent increased letter spacing in justification

As per the given code sample, the entity is entirely superfluous in this context. It must be inserted by some accident, most likely by a buggy editor trying to do smart things with whitespace or highlighting, or an enduser using a keyboard language wherein this character is natively been used, such as Arabic.

OTHER TIPS

If you want to search for these invisible characters in your editor and make them visible, you can use a Regular Expression searching for non-ascii characters. Try searching for [^\x00-\x7F]. Tested in IntelliJ IDEA.

I landed here with the same issue, then figured it out on my own. This weird character was appearing with my HTML.

The issue is most likely your code editor. I use Espresso and sometimes run into issues like this.

To fix it, simply highlight the affected code, then go to the menu and click "convert to numeric entities". You'll see the numeric value of this character appear; simply delete it and it's gone forever.

ZERO WIDTH SPACE.

I've used it as content for "empty" table cells. No idea what it's doing in a <script> tag, though.

The ZERO WIDTH SPACE character is inserted when you use jQuery to add elements using DOM manipulation functions like .before() and .after()

I've run into this when adding hidden modal dialog frames at the end of my document and then finding that the ZERO WIDTH SPACE screws up the layout down there, adding unwanted space.

The quick fix was to insert it before the footer, not after it. Its hidden anyway.

I can't find anything in jQuery that does this:

https://github.com/jquery/jquery/blob/master/src/manipulation.js

So it might be the browser that adds it.

I have these characters show up in scripts where I do not desire them. I noticed because it ruins my HTML/CSS visual formatting : it makes a new text box.

Pretty sure a buggy editor is adding them... I suspect Komodo Edit for the Mac, in my case.

If you're seeing these in a source be aware that it may be someone attempting to fingerprint text documents to reveal who is leaking information. It also may be an attempt to bypass a spam filter by making the same looking information different on a byte-by-byte level.

See my article on mitigating fingerprinting if you're interested in learning more.

It was displaying some weird characters (​) until I set the charset to UTF-8 in the head of the html file

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

or for HTML5:

<meta charset="UTF-8">

It it is now transparent but still shows in the html when I use the inspector.

Removing all the scripts from the page didn't remove it either.

I tested it for chrome and IE.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top