SCRIPT1028: Expected Identifier, String Or Number
Solution 1:
Internet Explorer have troubles with trailing commas in objects and arrays;
title: {
text: 'Description', //<--
}
You probably want:
title: {
text: 'Description'
}
Solution 2:
There are 2 common causes for this error. Either having a trailing comma when inappropriate, or using a JavaScript reserved word. In your case, you have 2 unnecessary commas. Below is the correct code snippet, with comments where I removed the commas.
element.qtip({
content: {
text: event.description,
title: {
text: '<?php _e('Description', 'event_espresso'); ?>' // Removed Comma
}
},
position: {
at: 'top right',
adjust: {
x: 0, y: 30
} // Removed Comma
},
I actually did a blog post (and video) explaining the error and showing examples and fixes. It can be found here: http://mikemclin.net/fixing-error-script1028-expected-identifier-string-or-number/
Solution 3:
Old version of IE doesn't support mal-formated JSON String.
You should never put a comma ',' separator when no braces '[', accolades '{' or new object properties come after.
Try :
position: {
at: 'top right',
adjust: {
x: 0, y: 30
} // <-- no comma here
},
instead of :
position: {
at: 'top right',
adjust: {
x: 0, y: 30
}, // <-- comma here
},
Solution 4:
If you are using Vuex and the issue manifests at the computed
hook calling mapState
, then the issue is with the spread operator.
},
computed: {
...mapState({
Use babel to fix it: https://babeljs.io/docs/en/babel-plugin-proposal-object-rest-spread
Solution 5:
Rather than work round compatibility mode you can force non-compatibility mode with...
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
in your <head>
tag.
Post a Comment for "SCRIPT1028: Expected Identifier, String Or Number"