In your case, the trick using jQuery style bindings is that you want to be able to pass element parameters to the handler ("data1", "data2"). The โmodernโ way to do this is as follows:
<a href="#" class='data-clickable' data-click-params='["data1", "data2"]'>Link</a>
Then, in the "finished" handler (or in another suitable place), you will attach the handler:
$('a.data-clickable').click(function(e) { var elementData = $(this).data('click-params');
The variable "elementData" will ultimately (in this case) be an array with two values โโin it, "data1" and "data2". You can assign the JSON notation values โโto the "data-foo" attributes, and when you extract the attributes using the jQuery ".data ()" method, it will automatically decrypt the JSON for you.
source share