Home  >  Article  >  Web Front-end  >  Briefly describe the three methods of passing introduction parameters of the Bind function in Jquery

Briefly describe the three methods of passing introduction parameters of the Bind function in Jquery

巴扎黑
巴扎黑Original
2017-06-25 11:04:551615browse

This article mainly introduces the three methods of passing and receiving Bind method parameters in Jquery. Friends in need can refer to

Method 1,


function GetCode(event)
{
alert(event.data.foo);
}


$(document).ready(function()
{
$("#summary").bind("click", {foo:'abc'} ,GetCode);
});

Method 2,

FunctionHandle


$("#summary").bind("click", function()
{
GetCode("abc")
});


function GetCode(str)
{
}

Method 3,

Function closure


function GetCode(str)
{
return function()
{
alert(str)
}}


$("#summary").bind("click", GetCode("abc"));

The above is the detailed content of Briefly describe the three methods of passing introduction parameters of the Bind function in Jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn