My guess is that you're currently binding click event handlers like this:
$('some-selector').click(function (event)
{
// do fancy stuff here
});
To encapsulate that logic, you just need to switch from using an anonymous function, to a function that you can reuse, like this:
function handleClicks(event)
{
// do fancy stuff here
}
$('some-selector').click(handleClicks);
$('some-other-selector').click(handleClicks);
How's that?
I might also take a guess at the fact that the logic you're writing and rewriting is to wire a "check-all" sort of checkbox to a group of checkboxes. I wrote a jQuery plugin recently to handle exactly this sort of thing.
I never got around to uploading it properly to GitHub - here's the gist of it. Let me know if you'd like to actually use it, and I can explain its usage - it's pretty darn simple.