Home > Web Front-end > JS Tutorial > 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

巴扎黑
Release: 2017-06-25 11:04:55
Original
1652 people have browsed it

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);
}
Copy after login


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

Method 2,

FunctionHandle


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


function GetCode(str)
{
}
Copy after login

Method 3,

Function closure


function GetCode(str)
{
return function()
{
alert(str)
}}
Copy after login


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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template