Home >Web Front-end >JS Tutorial >Three methods for passing and receiving parameters in Jquery's Bind method_jquery
Method 1,
function GetCode(event) { alert(event.data.foo); }
$(document).ready(function() { $("#summary").bind("click", {foo:'abc'} ,GetCode); });
Method 2,
Function handle
$("#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"));