jquery bind 传参数
方法一、
|
1
2
3
4
|
function GetCode(event){alert(event.data.foo);} |
|
1
2
3
4
|
$(document).ready(function(){$("#summary").bind("click", {foo:'abc'} ,GetCode);}); |
方法二、
函数句柄
|
1
2
3
4
|
$("#summary").bind("click", function(){GetCode("abc")}); |
|
1
2
3
|
function GetCode(str){} |
方法三、
函数闭包
|
1
2
3
4
5
6
|
function GetCode(str){return function(){alert(str)}} |
|
1
|
$("#summary").bind("click", GetCode("abc")); |

浙公网安备 33010602011771号