Skip to content Skip to sidebar Skip to footer

Expected Identifier, String Or Number

I have an object like; var defaults = { id: 'ActionSlider', element: '', closeBtnWidth: 55, panelWidth: 320, class: '', css: {},

Solution 1:

You need to add quotes round the class which is a reserved word. Please also note, that you should remove the last comma:

var defaults = {
        id: 'ActionSlider',
        element: '',
        closeBtnWidth: 55,
        panelWidth: 320,
        "class": '',
        css: {},
        create: function() {}
    }

Solution 2:

Yep, class is a reserved word. MDN

Solution 3:

Solution 4:

Usually class refers to the class attribute of any object like <div >, <input > etc. which shows displays class as <div class="someclass">

Post a Comment for "Expected Identifier, String Or Number"