$("#mySecondDiv").bind('my-event', function(event, a ,b) { /* ... */ });
$("#mySecondDiv").trigger('my-event', [1, 2]);
Here is a function defined inside bind()
method . I want this function to be once defined globally and use for multiple elements.
For example :
function{ //definition }
$("#mySecondDiv").bind('my-event', --call above function here--);
$("#mySecondDiv").trigger('my-event', [1, 2]);
$("#myAnotherDiv").bind('my-event', --again call the same above function here--);
$("#myAnotherDiv").trigger('my-event', [1, 2]);
How can I achieve this ?