Javascript vs. IE8 - Expected identifier, string or number

后端 未结 3 1975
孤城傲影
孤城傲影 2021-02-08 06:34

No, it\'s not an extra comma.

Here is the snip that is giving me the problem.

$(document).ready(function(){   
    $(\"div#slider\").easySlider({
                


        
相关标签:
3条回答
  • 2021-02-08 07:09

    In 2015. if you still care about IE8 compatibility (more or less), my issue with this error was only manifesting on a live server, but didn't happen on localhost (go figure). And, it triggered IE8 error in such a way that it went down into IE7 Compatibility View, which also sucks just the same as Quirks Mode.

    In any case, the problem could not be solved by any of the above tips, and the issue was a trailing comma after listing some parameters/options.

    For Example:

    $(document).ready(function(){
        $('#selector').func({
            rules: {
                parameter1: {
                    option1: true,
                    option2: 1,
                    option3: 5
                }
            }, // <- this trailing comma is fatal to IE8
        });
    });
    
    0 讨论(0)
  • 2021-02-08 07:23

    Try putting all your object properties in (double)quotes, like this:

    $("div#slider").easySlider({
        'auto': false,
        'continuous': true,
        'nextId': "nextBtn",
        'prevId': "prevBtn"
    });
    
    0 讨论(0)
  • 2021-02-08 07:23

    I had similar issue with knockout class attr binding. It happened that the class attribute had to be enclosed in quotes like 'class'.

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