i have defined (saved) a function inside the .data() method of jQuery of an object, to use that function later on in my code.
Problem: how can i pass parameters to that function when i want to call (use) it.
ex:
// function declaration
var obj = {};
$(obj).data('callback',function(parameter[s]){
// do something with parameter
});
// calling the function (usage)
$(obj).data('callback')(parameter[s]);
var obj = {};
$(obj).data('callback',function(number){
console.log(number++);
});
$(obj).data('callback')(1);
is this that i have written right?
thank you for answering