admin管理员组文章数量:1026989
I'm using structured javascript code and it works fine on my puter. But when I add it to jsFiddle, it gives me the followinge error:
SyntaxError: Unexpected token :
My code looks like this:
var StentGallery = {
gallery: null,
init : function(){
this.gallery = jQuery('#gallery-list-ui');
this.resizeImage();
}
}
(...)
}
Does anyone know why this is not working in jsFiddle?
See my fiddle here: /
I'm using structured javascript code and it works fine on my puter. But when I add it to jsFiddle, it gives me the followinge error:
SyntaxError: Unexpected token :
My code looks like this:
var StentGallery = {
gallery: null,
init : function(){
this.gallery = jQuery('#gallery-list-ui');
this.resizeImage();
}
}
(...)
}
Does anyone know why this is not working in jsFiddle?
See my fiddle here: https://jsfiddle/smyhbckx/
2 Answers
Reset to default 5There's a syntax error in your code:
var StentGallery = {
gallery: null,
init : function(){
this.gallery = jQuery('#gallery-list-ui');
this.resizeImage();
} // <----- this is prematurely closing your object
},
resizeImage: function(){
...
To fix this, simply remove that bracket:
var StentGallery = {
gallery: null,
init : function(){
this.gallery = jQuery('#gallery-list-ui');
this.resizeImage();
},
resizeImage: function(){
...
There's an extra closing '}' for your init function.
I'm using structured javascript code and it works fine on my puter. But when I add it to jsFiddle, it gives me the followinge error:
SyntaxError: Unexpected token :
My code looks like this:
var StentGallery = {
gallery: null,
init : function(){
this.gallery = jQuery('#gallery-list-ui');
this.resizeImage();
}
}
(...)
}
Does anyone know why this is not working in jsFiddle?
See my fiddle here: /
I'm using structured javascript code and it works fine on my puter. But when I add it to jsFiddle, it gives me the followinge error:
SyntaxError: Unexpected token :
My code looks like this:
var StentGallery = {
gallery: null,
init : function(){
this.gallery = jQuery('#gallery-list-ui');
this.resizeImage();
}
}
(...)
}
Does anyone know why this is not working in jsFiddle?
See my fiddle here: https://jsfiddle/smyhbckx/
2 Answers
Reset to default 5There's a syntax error in your code:
var StentGallery = {
gallery: null,
init : function(){
this.gallery = jQuery('#gallery-list-ui');
this.resizeImage();
} // <----- this is prematurely closing your object
},
resizeImage: function(){
...
To fix this, simply remove that bracket:
var StentGallery = {
gallery: null,
init : function(){
this.gallery = jQuery('#gallery-list-ui');
this.resizeImage();
},
resizeImage: function(){
...
There's an extra closing '}' for your init function.
本文标签: javascriptWhy is jsfiddle giving me the error quotSyntaxError Unexpected token quotStack Overflow
版权声明:本文标题:javascript - Why is jsfiddle giving me the error "SyntaxError: Unexpected token :"? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745667929a2162282.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论