Jquery之Bind方法参数传递与接收的三种方法
时间:2021-02-22 18:02:07|栏目:jquery|点击: 次
方法一、
function GetCode(event)
{
alert(event.data.foo);
}
$(document).ready(function()
{
$("#summary").bind("click", {foo:'abc'} ,GetCode);
});
方法二、
函数句柄
$("#summary").bind("click", function()
{
GetCode("abc")
});
function GetCode(str)
{
}
方法三、
函数闭包
function GetCode(str)
{
return function()
{
alert(str)
}}
$("#summary").bind("click", GetCode("abc"));
栏 目:jquery
下一篇:jQuery实现input[type=file]多图预览上传删除等功能
本文标题:Jquery之Bind方法参数传递与接收的三种方法
本文地址:http://www.codeinn.net/misctech/67885.html






