SCRIPT1014: Invalid character

后端 未结 4 2174
北海茫月
北海茫月 2020-11-30 12:47

I have this script:

function slideSwitch() {
    var ae = jQuery(\'#featured-right a.active\');
    if ( ae.length == 0 ) {
        ae = jQuery(\'#featured-r         


        
相关标签:
4条回答
  • 2020-11-30 13:07

    The problem is likely to be that the file is UTF-8 encoded and the file is being brought in via a script tag which doesn't define this encoding. If you add charset="UTF-8" as an attribute to the importing script tag hopefully that'll fix it.

    0 讨论(0)
  • 2020-11-30 13:23

    It seems that IE didn't like the fact that i was accessing the page without a HTTP server :) I was accessing c:\www\my-file. When accessing http://localhost/my-file .. worked great.

    0 讨论(0)
  • 2020-11-30 13:23

    Watch out for template string literals. This error was caused by a

    `
    

    character for me in IE11.

    0 讨论(0)
  • 2020-11-30 13:30

    I had this same problem. It said there was an error in line 1 row 1 of the main file. I use a ton of AJAX in the page I was using.

    It all boiled down to the fact that I had onclick="#" on an A tag. Once I removed that, the error went away.

    I think when jQuery loads the html via an AJAX call, it takes the onclick tags and processes the javascript it finds inside.

    0 讨论(0)
提交回复
热议问题