我尝试使用Jquery切换事件如下:
$("button:eq(2)").toggle(function(){
$(this).attr("style","background:red");},
function(){
$(this).attr("style","background:blue");},
function(){
$(this).attr("style","background:green");}
);
如果使用jquery v1.6.1,它可以正常运行,但是一旦更改为jquery最新版本v1.9.1,它将抛出followng异常:
未捕获TypeError:属性'function(){ $(this).attr(“style”,“background:blue”);}'对象#不是函数
有人知道这是由jquery bug引起的还是因为编码有问题?