0

I tried to use Jquery toggle event as following:

$("button:eq(2)").toggle(function(){
                                $(this).attr("style","background:red");},
                                function(){
                                $(this).attr("style","background:blue");},
                                function(){
                                $(this).attr("style","background:green");}
                        );

It could run properly if using jquery v1.6.1,But once changed to jquery latest version v1.9.1,it would throw followng exception:

Uncaught TypeError: Property 'function (){ $(this).attr("style","background:blue");}' of object # is not a function

Does anybody know this is caused by jquery bug or just because of the coding has some problem?

Chailie
  • 451
  • 2
  • 11
  • 24
  • This version of `.toggle` was removed from jQuery 1.9: http://jquery.com/upgrade-guide/1.9/#toggle-function-function-removed. You can have a look at [this question](http://stackoverflow.com/q/4911577/218196) for an alternative solution. – Felix Kling Feb 23 '13 at 10:57

1 Answers1

2

It was removed in jQuery 1.9. - http://jquery.com/upgrade-guide/1.9/

arnisritins
  • 1,250
  • 3
  • 15
  • 23