Home > Article > Web Front-end > Briefly describe the three methods of passing introduction parameters of the Bind function in Jquery
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!