Works in jsFiddle but not in my Site

自古美人都是妖i 提交于 2019-12-02 06:27:35

问题


For some reason this jQuery code I have in my site will work on jsFiddle but not locally. The code is the same. I have just copied and pasted it. Can anyone explain to me what is going on?

  • jsFiddle
  • Local

回答1:


Using Chrome's developer tools, you get an error in the console: Uncaught SyntaxError: Unexpected token ILLEGAL

Taking a look at the code, you see:

$(document).ready(function() {

    $('#workclick').click(function() {
    $("#header").height($("#headwrapper").height());

    });
    $('#workclick').click();

    $('#aboutclick, #contactclick, #introclick').click(function() {
    $("#header").height('0');
    });​ // here
});

Some kind of encoding error...




回答2:


Firebug is complaining about a ​ in your code (line 562), which happens to be an illegal character.




回答3:


I found a weird hidden character in my Jquery. Not sure where it came from or why it wasnt showing up in my editor, but I got ride of it and it works fine. Thanks for the help everyone!




回答4:


Sorry for my bad english

i have idea for copy the full source code

steps

  1. click on the Share button

    2 copy the link of on 2 box Share full screen result

3 then go that link(copy link). it show the result

4 then right click, click the view frame source.

Now your source code show

then put on the exact link of the script src and css.

now your code work



来源:https://stackoverflow.com/questions/9322628/works-in-jsfiddle-but-not-in-my-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!