[英]Uncaught SyntaxError: Unexpected token {
Current jQuery Being used 当前使用的jQuery
$("#like_button").live("click", function(){
var status = $(this).data("status");
var id = $(this).data("id");
var count = $(this).html();
if(status === 1){
like(id);
$(this).removeClass("likes");
$(this).addClass("liked");
count++;
$(this).html(count);
}elseif(status === 2){
like(id);
$(this).removeClass("liked");
$(this).addClass("likes");
count--;
$(this).html(count);
} else {
// do nothing
}
return false;
});
The Error 错误
Uncaught SyntaxError: Unexpected token { (Line 529)
Which is this line below, 这是下面的这行
}elseif(status === 2){
If you need anymore information to help me with this please be sure to ask. 如果您需要更多信息来帮助我,请务必询问。
JavaScript使用else if
,而不使用elseif
。
阅读本教程以了解有关if else语句的更多信息http://www.w3schools.com/js/js_if_else.asp
This statement 这个说法
}elseif(status === 2){
has to be 必须
}else if(status === 2){
Missing a space between else and if 在else和if之间缺少空格
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.