JQuery allows a couple of functions that allows you to pass additional data to a click event. Heres an example
HTML :
<button id="button1">HI</button>
<button id="button2">HI</button>
JS :
var custom = "Hello world";
$('#button1').on('click', {txt:custom}, function (e) {
this.innerHTML = e.data.txt; // button 1 text changes to Hello world
});
var customfn = function (txt) {
// the scope of the txt argument will be
// available in the returning function
return function () {
this.innerHTML = txt; // button 2 text changes to BYE
}
}
$('#button2').on('click', {txt:custom}, customfn("BYE"));
You should also take a look at jQuery.proxy. I haven't tested the code out but the basic idea is there