jquery toggle问题

本文出自:http://blog.csdn.net/liuyanzhi08/article/details/8860042

我想用toggle来切换多个单击事件,但是js控制台提示错误如下:

 

Uncaught TypeError: Property 'function (){
				alert("func2");
			}' of object #<Object> is not a function 


我的html源代码如下:

 

 

<html>
<head>
	<title>jsDev</title>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
	</style>
	<script type="text/javascript">
		$(function(){
			$("button").toggle(function(){
				alert("func1");
			}, function(){
				alert("func2");
			}, function(){
				alert("func3");
			});
		})
	</script>
</head>
<body>
	<button>Click me</button>
</body>
</html>


最后在网上查找了好久,最终在jquery api上得到了雷人的答案。。。

 





⊙﹏⊙b汗。。得出的结论是,有问题查官网。。官方的最权威

 

posted @ 2013-04-27 20:02  javawebsoa  Views(162)  Comments(0Edit  收藏  举报