JavaScript 中奇怪的意外令牌非法 [英] Strange Unexpected token ILLEGAL in JavaScript

查看:18
本文介绍了JavaScript 中奇怪的意外令牌非法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个无法解决的语法错误.基于 W3 jQuery 学校,这应该没问题.有人可以帮忙吗?

I have a syntax error which I cannot solve. Based on W3 jQuery schools, this should be okay. Can anyone help?

<script type="text/javascript">
    jQuery(document).ready(function($) {
        $("a").click(function(){
            **Uncaught SyntaxError: Unexpected token ILLEGAL**
                $(#content).toggle(400);
            });
        });
</script>

推荐答案

字符串需要用 U+0022(双引号 - ")字符或 包围>U+0027(撇号 - ')个字符.

Strings need to be surrounded with U+0022 (double quote - ") characters or U+0027 (apostrophe - ') characters.

你的第一个选择器,a被一对U+201C/U+201D(左双引号/右双引号 - /") 个字符.

Your first selector, a is surrounded with a pair of U+201C/U+201D (left double quotation mark/right double quotation mark - "/") characters.

您的第二个选择器 (#content) 周围根本没有引号.

Your second selector (#content) has no quotes around it at all.

这篇关于JavaScript 中奇怪的意外令牌非法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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