为什么以下jquery在jsfiddle中起作用,但在任何浏览器上却不起作用? [英] Why does the following jquery work in jsfiddle, but not on any browser?

查看:80
本文介绍了为什么以下jquery在jsfiddle中起作用,但在任何浏览器上却不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在FF和chrome中打开以下代码,没有任何反应.但是,当我将确切的代码加载到jsfiddle中时,它起作用了.

I tried opening the following code in both FF and chrome, nothing happened. But when I loaded the exact code in jsfiddle, it worked .

jsfiddle链接

HTML:

<!doctype html>

<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="fgerg.css" />
<script type="text/javascript" src="jquery-1.7.2.js"></script>


<script type="text/javascript">
                $(document).ready(function() {



                    $('#showButton').click(function() {
                        $('#x2').css('visibility','visible');


                    });     
                });​

            </script>   
</head>

<body>
 <input type="button" id="showButton" value="show" />
    <p id="x"> gergreg</p>
    <p id="x2"> sadeijnfciu </p>        
</body>
    </html>

CSS:

#x {
display:none;
 }

 #x2 {
visibility: hidden;
}

对于任何感兴趣的人,最后一个});之后的矩形会造成整个混乱.有人知道那是什么吗?

For anyone interested, the rectangle after the last }); caused the whole mess. Anyone know what is that ?

推荐答案

错误:未捕获的SyntaxError:意外的标记ILLEGAL 通常意味着您在页面/JavaScript源中的某个地方有一些奇怪的编码字符.最好的选择是使用显示特殊字符打开文件编辑器,或创建一个新文件并在代码的各个部分进行复制.

The error: Uncaught SyntaxError: Unexpected token ILLEGAL normally means you have some weird encoded character somewhere in your page/JavaScript source. Best bet is to either open the files up editor with it showing special characters, or to create a new file and copy in sections of the code.

这篇关于为什么以下jquery在jsfiddle中起作用,但在任何浏览器上却不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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