未捕获的SyntaxError:针对Chrome浏览器的意外令牌非法 [英] Uncaught SyntaxError: Unexpected token ILLEGAL for Chrome Browser

查看:388
本文介绍了未捕获的SyntaxError:针对Chrome浏览器的意外令牌非法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

toggle.js

  var $ jq = jQuery.noConflict(); 
$ jq(document).ready(function(){

$ jq('。isAdd')。hide();

$ jq( ();
var value = $ jq(#Add_category option:checked)。val();
var theDiv = $ jq(。isAdd);

theDiv.slideToggle(slow);
});
});

在控制台中,我有:


未捕获的SyntaxError:意外的令牌非法


对于Firefox而言,它可以正常工作,但不适用于Chrome和Chromium for Ubuntu。 / div>

在最后一行的最后一行}); 后面有一个不可见的字符。当我将它粘贴到我的编辑器中时,它显示为



在编辑器中查看您的代码,用某种符号显示不可打印的字符,或在十六进制编辑器中查看。


toggle.js

var $jq = jQuery.noConflict();
$jq(document).ready(function(){

    $jq('.isAdd').hide();

    $jq("#Add_category").change(function(){          
        var value = $jq("#Add_category option:checked").val();
        var theDiv = $jq(".isAdd");

        theDiv.slideToggle("slow");
    });
});​

In console I had:

Uncaught SyntaxError: Unexpected token ILLEGAL

For Firefox it's works fine, but not for Chrome and Chromium for Ubuntu.

解决方案

There is an invisible character following the last }); of your last line. When I pasted it into my editor, it appeared as a ..

View your code in an editor capable of displaying non-printable characters with some kind of symbol, or view it in a hex editor.

这篇关于未捕获的SyntaxError:针对Chrome浏览器的意外令牌非法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆