i have two different divs (code was simplified, this is not the actual code.)
You have two options, either you could give both of those divs a class and then just run the code:
$(".myclass").click(function() {
DoWork();
});
Or you could define a function like:
function hookClick(arr, handler) {
foreach (var i in arr) {
$(i).click(handler);
}
}
then run it using
hookClick(["#div1", "#div2"], function() { /*do sth cool })